Part Number Hot Search : 
TA0872A P0721A2L MHW5382 ICS87 MTZJ22 CY621 AN1071 S2370
Product Description
Full Text Search
 

To Download HD64F3048F16 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  to our customers, old company name in catalogs and other documents on april 1 st , 2010, nec electronics corporation merged with renesas technology corporation, and renesas electronics corporation took over all the business of both companies. therefore, although the old company name remains in this document, it is a valid renesas electronics document. we appreciate your understanding. renesas electronics website: http://www.renesas.com april 1 st , 2010 renesas electronics corporation issued by: renesas electronics corporation ( http://www.renesas.com ) send any inquiries to http://www.renesas.com/inquiry .
notice 1. all information included in this document is current as of the date this document is issued. such information, however, is subject to change without any prior notice. before purchasing or using any renesas electronics products listed herein, please confirm the latest product information with a renesas electronics sales office. also, please pay regular and careful attention to additional and different information to be disclosed by renesas electronics such as that disclosed through our website. 2. renesas electronics does not assume any liability for infringement of patents, copyrights, or other intellectual property ri ghts of third parties by or arising from the use of renesas electronics products or technical information described in this document . no license, express, implied or otherwise, is granted hereby under any patents, copyrights or other intellectual property right s of renesas electronics or others. 3. you should not alter, modify, copy, or otherwise misappropriate any renesas electronics product, whether in whole or in part . 4. descriptions of circuits, software and other related information in this document are provided only to illustrate the operat ion of semiconductor products and application examples. you are fully responsible for the incorporation of these circuits, software, and information in the design of your equipment. renesas electronics assumes no responsibility for any losses incurred by you or third parties arising from the use of these circuits, software, or information. 5. when exporting the products or technology described in this document, you should comply with the applicable export control laws and regulations and follow the procedures required by such laws and regulations. you should not use renesas electronics products or the technology described in this document for any purpose relating to military applications or use by the military, including but not limited to the development of weapons of mass destruction. renesas electronics products and technology may not be used for or incorporated into any products or systems whose manufacture, use, or sale is prohibited under any applicable domestic or foreign laws or regulations. 6. renesas electronics has used reasonable care in preparing the information included in this document, but renesas electronics does not warrant that such information is error free. renesas electronics assumes no liability whatsoever for any damages incurred by you resulting from errors in or omissions from the information included herein. 7. renesas electronics products are classified according to the following three quality grades: ?standard?, ?high quality?, an d ?specific?. the recommended applications for each renesas electronics product depends on the product?s quality grade, as indicated below. you must check the quality grade of each renesas electronics product before using it in a particular application. you may not use any renesas electronics product for any application categorized as ?specific? without the prior written consent of renesas electronics. further, you may not use any renesas electronics product for any application for which it is not intended without the prior written consent of renesas electronics. renesas electronics shall not be in any way liable for any damages or losses incurred by you or third parties arising from the use of any renesas electronics product for a n application categorized as ?specific? or for which the product is not intended where you have failed to obtain the prior writte n consent of renesas electronics. the quality grade of each renesas electronics product is ?standard? unless otherwise expressly specified in a renesas electronics data sheets or data books, etc. ?standard?: computers; office equipment; communications equipment; test and measurement equipment; audio and visual equipment; home electronic appliances; machine tools; personal electronic equipment; and industrial robots. ?high quality?: transportation equipment (automobiles, trains, ships, etc.); traffic control systems; anti-disaster systems; an ti- crime systems; safety equipment; and medical equipment not specifically designed for life support. ?specific?: aircraft; aerospace equipment; submersible repeaters; nuclear reactor control systems; medical equipment or systems for life support (e.g. artificial life support devices or systems), surgical implantations, or healthcare intervention (e.g. excision, etc.), and any other applications or purposes that pose a direct threat to human life. 8. you should use the renesas electronics products described in this document within the range specified by renesas electronics , especially with respect to the maximum rating, operating supply voltage range, movement power voltage range, heat radiation characteristics, installation and other product characteristics. renesas electronics shall have no liability for malfunctions o r damages arising out of the use of renesas electronics products beyond such specified ranges. 9. although renesas electronics endeavors to improve the quality and reliability of its products, semiconductor products have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. fur ther, renesas electronics products are not subject to radiation resistance design. please be sure to implement safety measures to guard them against the possibility of physical injury, and injury or damage caused by fire in the event of the failure of a renesas electronics product, such as safety design for hardware and software including but not limited to redundancy, fire control and malfunction prevention, appropriate treatment for aging degradation or any other appropriate measures. because the evaluation of microcomputer software alone is very difficult, please evaluate the safety of the final products or system manufactured by you. 10. please contact a renesas electronics sales office for details as to environmental matters such as the environmental compatibility of each renesas electronics product. please use renesas electronics products in compliance with all applicable laws and regulations that regulate the inclusion or use of controlled substances, including without limitation, the eu rohs directive. renesas electronics assumes no liability for damages or losses occurring as a result of your noncompliance with applicable laws and regulations. 11. this document may not be reproduced or duplicated, in any form, in whole or in part, without prior written consent of renes as electronics. 12. please contact a renesas electronics sales office if you have any questions regarding the information contained in this document or renesas electronics products, or if you have any other inquiries. (note 1) ?renesas electronics? as used in this document means renesas electronics corporation and also includes its majority- owned subsidiaries. (note 2) ?renesas electronics product(s)? means any product developed or manufactured by or for renesas electronics.
h8/3048b group hardware manual 8 users manual rev.3.00 2006.09 renesas 8-bit single-chip microcomputer h8 family/h8/300h series h8/3048b hd6433048b hd6433048bv h8/3048f-one hd64f3048b hd64f3048bv
rev. 3.00 sep 27, 2006 page ii of xxvi 1. these materials are intended as a reference to assist our customers in the selection of the renesas technology corp. product best suited to the customer's application; they do not convey any license under any intellectual property rights, or any other rights, belonging to renesas technology corp. or a third party. 2. renesas technology corp. assumes no responsibility for any damage, or infringement of any third- party's rights, originating in the use of any product data, diagrams, charts, programs, algorithms, or circuit application examples contained in these materials. 3. all information contained in these materials, including product data, diagrams, charts, programs and algorithms represents information on products at the time of publication of these materials, and are subject to change by renesas technology corp. without notice due to product improvements or other reasons. it is therefore recommended that customers contact renesas technology corp. or an authorized renesas technology corp. product distributor for the latest product information before purchasing a product listed herein. the information described here may contain technical inaccuracies or typographical errors. renesas technology corp. assumes no responsibility for any damage, liability, or other loss rising from these inaccuracies or errors. please also pay attention to information published by renesas technology corp. by various means, including the renesas technology corp. semiconductor home page (http://www.renesas.com). 4. when using any or all of the information contained in these materials, including product data, diagrams, charts, programs, and algorithms, please be sure to evaluate all information as a total system before making a final decision on the applicability of the information and products. renesas technology corp. assumes no responsibility for any damage, liability or other loss resulting from the information contained herein. 5. renesas technology corp. semiconductors are not designed or manufactured for use in a device or system that is used under circumstances in which human life is potentially at stake. please contact renesas technology corp. or an authorized renesas technology corp. product distributor when considering the use of a product contained herein for any specific purposes, such as apparatus or systems for transportation, vehicular, medical, aerospace, nuclear, or undersea repeater use. 6. the prior written approval of renesas technology corp. is necessary to reprint or reproduce in whole or in part these materials. 7. if these products or technologies are subject to the japanese export control restrictions, they must be exported under a license from the japanese government and cannot be imported into a country other than the approved destination. any diversion or reexport contrary to the export control laws and regulations of japan and/or the country of destination is prohibited. 8. please contact renesas technology corp. for further details on these materials or the products contained therein. 1. renesas technology corp. puts the maximum effort into making semiconductor products better and more reliable, but there is always the possibility that trouble may occur with them. trouble with semiconductors may lead to personal injury, fire or property damage. remember to give due consideration to safety when making your circuit designs, with appropriate measures such as (i) placement of substitutive, auxiliary circuits, (ii) use of nonflammable material or (iii) prevention against any malfunction or mishap. keep safety first in your circuit designs! notes regarding these materials
rev. 3.00 sep 27, 2006 page iii of xxvi general precautions on handling of product 1. treatment of nc pins note: do not connect anything to the nc pins. the nc (not connected) pins are either not connected to any of the internal circuitry or are used as test pins or to reduce noise. if something is connected to the nc pins, the operation of the lsi is not guaranteed. 2. treatment of unused input pins note: fix all unused input pins to high or low level. generally, the input pins of cmos products are high-impedance input pins. if unused pins are in their open states, intermediate levels are induced by noise in the vicinity, a pass- through current flows internally, and a malfunction may occur. 3. processing before initialization note: when power is first supplied, the product?s state is undefined. the states of internal circuits are undefined until full power is supplied throughout the chip and a low level is input on the reset pin. during the period where the states are undefined, the register settings and the output state of each pin are also undefined. design your system so that it does not malfunction because of processing while it is in this undefined state. for those products which have a reset function, reset the lsi immediately after the power supply has been turned on. 4. prohibition of access to undefined or reserved addresses note: access to undefined or reserved addresses is prohibited. the undefined or reserved addresses may be used to expand functions, or test registers may have been be allocated to these addresses. do not access these registers; the system?s operation is not guaranteed if they are accessed.
rev. 3.00 sep 27, 2006 page iv of xxvi
rev. 3.00 sep 27, 2006 page v of xxvi preface the h8/3048b group is a series of high-performance microcontrollers that integrate system supporting functions together with an h8/300h cpu core. in addition, the h8/3048f-one is equipped with an on-chip emulator (e10t) * 2 . the h8/300h cpu has a 32-bit internal architecture with sixteen 16-bit general registers, and a concise, optimized instruction set designed for speed. it can address a 16-mbyte linear address space. the on-chip emulator (e10t) * 2 has functions that allow it to emulate directly a microcontroller mounted on the user board. this makes possible on-board program debugging. the on-chip supporting functions include rom, ram, a 16-bit integrated timer unit (itu), a programmable timing pattern controller (tpc), a watchdog timer (wdt), a serial communication interface (sci), an a/d converter, a d/a converter, i/o ports, a direct memory access controller (dmac), a refresh controller, and other facilities. of the two sci channels, one has been expanded to support the iso/iec7816-3 smart card interface. functions have also been added to reduce power consumption in battery-powered applications: individual modules can be placed in standby, and the frequency of the system clock supplied to the chip can be divided down under software control. the address space is divided into eight areas. the data bus width and access cycle length can be selected independently in each area, simplifying the connection of different types of memory. seven operating modes (modes 1 to 7) are provided, offering a choice of data bus width and address space size. with these features, the h8/3048b group can be used to implement compact, high-performance systems easily. versions with either flash memory (f-ztat? * 1 ) or mask rom as the on-chip rom are available. this enables users to respond quickly and flexibly to changing application specifications from the initial production stage through full-scale volume production. this manual describes the h8/3048b group hardware. for information on h8/3048 group products, please refer to the h8/3048 group hardware manual. for details of the instruction set, refer to the h8/300h series programming manual. notes: 1. f-ztat (flexible ztat) is a trademark of renesas technology corp. 2. an on-chip emulator (e10t) is not provided in the mask rom version.
rev. 3.00 sep 27, 2006 page vi of xxvi notes on using the on-chip emulator (e10t) installed in the h8/3048f-one h8/3048 group products and h8/3048b group products have different specifications regarding the pin arrangement (pin 1, vcl), flash memory, and maximum operating frequency. refer to comparison of h8/3048 group product specifications for details of these differences. notes: when using an on-chip emulator (e10t) for h8/3048 program development and debugging, the following restrictions must be noted. 1. only programs in the on-chip flash memory can be developed and debugged. consequently, emulation is not possible for programs in external memory or in the no-rom mode. 2. refresh controller and dmac operation are not supported, so settings should not be made to the registers for these modules. 3. during break mode of on-chip emulation, the watchdog timer stops counting. accordingly, the counter value may be invalid after resuming from the break mode. 4. the fwe (brk) pin and pins p91, p93, and p95 are reserved for the e10t, and cannot be used. 5. area h'f7000 to h'f7fff in 1-m address mode (area h'ff7000 to h'ff77ff in 16-m address mode) is used by the e10t, and is not available to the user. 6. the initial program instructions following a reset should be initialize stack pointer (sp) and read mode register (mdcr). (after initializing sp using the mov.l instruction, use the mov.b instruction to read the mdcr register.) 7. emulation of the hardware standby mode is not supported.
rev. 3.00 sep 27, 2006 page vii of xxvi comparison of h8/3048 group product specifications there are eight members of the h8/3048 group; the h8/3048f-ztat (h8/3048f * 1 , h8/3048f- one * 2 ), h8/3048ztat, h8/3048 mask rom version, h8/3048b mask rom version, h8/3047 mask rom version, h8/3045 mask rom version, and h8/3044 mask rom version. the specifications of each model is compared below. notes: 1. h8/3048f has dual power supply with flash memory installed. 2. h8/3048f-one has single power supply with flash memory and e10t installed. hardware manual h8/3048 group (rev. 7.0) h8/3048b group (rev. 3.0) rom type ztat mask rom f-ztat mask rom model type h8/3048 h8/3048 mask rom version h8/3047 mask rom version h8/3045 mask rom version h8/3044 mask rom version h8/3048f h8/3048f-one h8/3048b mask rom version model spec prom model mask rom model dual power supply, flash memory is installed single power supply, flash memory installed, internal step- down (5 v operation model), high-speed operation model mask rom model refer to 1.4, differences between h8/3048f and h8/3048f-one. refer to 1.4.3, differences between h8/3048f and h8/3048f-one. model type no. hd6473048 hd6433048 hd6433047 hd6433045 hd6433044 hd64f3048 hd64f3048b (5 v operation model) hd64f3048bv (3 v operation model) hd6433048b (5 v operation model) hd6433048bv (3 v operation model) pin assignment refer to figure 1.2, pin arrangement of h8/3048ztat, h8/3048 mask rom version, h8/3047 mask rom version, h8/3045 mask rom version, h8/3044 mask rom version, and h8/3048f (fp-100b or tfp-100b, top view), in section 1. 5-v operation models have a v c l pin and an external capacitor must be connected. refer to figure 1.3, h8/3048f-one pin arrangement (fp-100b or tfp- 100b, top view), in section 1.
rev. 3.00 sep 27, 2006 page viii of xxvi hardware manual h8/3048 group (rev. 7.0) h8/3048b group (rev. 3.0) rom type ztat mask rom f-ztat mask rom ram capacity 4 kbytes h8/3048: 4 kbytes h8/3047: 4 kbytes h8/3045: 2 kbytes h8/3044: 2 kbytes 4 kbytes 4 kbytes rom capacity 128 kbytes h8/3048: 128 kbytes h8/3047: 96 kbytes h8/3045: 64 kbytes h8/3044: 32 kbytes 128 kbytes 128 kbytes flash memory ? ? refer to section 19, flash memory (h8/3048f dual power supply). refer to section 18, rom (h8/3048f-one: single power supply, h8/3048b mask rom version) ? clock pulse generator refer to section 20, clock pulse generator. refer to section 19, clock pulse generator. refer to section 21, power-down state. refer to section 20, power-down state. power-down state clock oscillator settling time: waiting time of up to 131072 states clock oscillator settling time: waiting time of up to 262144 states refer to table 22.1, electrical characteristics of h8/3048 group products, in section 22. refer to table 21.1, electrical characteristics of h8/3048 group and h8/3048b group products, in section 21. electrical characteristics (clock rate) 1 to 18 mhz 1 to 16 mhz 5 v operation models: 2 to 25 mhz, 3 v operation models: 2 to 25 mhz. list of registers refer to table b.1, comparison of h8/3048 group internal i/o register specifications, in appendix b. refer to appendix b.1, addresses. notes on usage ? ? ? refer to section 1.4, notes on h8/3048f-one (single power supply) ? on-chip emulator (e10t) ? ? ? on-chip emulator (e10t) ?
rev. 3.00 sep 27, 2006 page ix of xxvi main revisions for this edition item page revision (see manual for details) all ?  notification of change in company name amended (before) hitachi, ltd. (after) renesas technology corp.  product naming convention amended (before) h8/3048b series (after) h8/3048b group 1.3.1 pin arrangement figure 1.3 h8/3048b group pin arrangement (fp- 100b or tfp-100b, top view) 8 note amended note: 1. for the 5 v operation product, this pin is used as the v c l terminal, and for the 3 v operation models, this pin is used as the v c c terminal that requires an external capacitor. 1.3.3 pin functions table 1.4 pin functions 18, 19 table amended type symbol pin no. i/o name and function a/d and d/a converters av cc 76 input power supply pin for the a/d and d/a converters. connect to the system power supply ( v cc ) when not using the a/d and d/a converters. av ss 86 input ground pin for the a/d and d/a converters. connect to system ground ( v ss ). v ref 77 input reference voltage input pin for the a/d and d/a converters. connect to the system power supply ( v cc ) when not using the a/d and d/a converters. 1.4.2 product type names and markings table 1.5 differences in h8/3048f and h8/3048f-one 21 sample markings amended dual power supply model: h8/3048f single power supply model: h8/3048f-one sample markings h8/3048 hd 64f3048f16 3j1 h8/3048f-one pgm 5.0 b 0021 bk80090 64f3048f25 h8/3048f-one pgm 3.3 b 0021 bk80090 64f3048vf25
rev. 3.00 sep 27, 2006 page x of xxvi item page revision (see manual for details) 5.5.4 usage notes on external interrupts figure 5.9 irqnf flag when interrupt processing is not conducted 120 figure amended read 1 write 0 read 1 write 1 irqb execution read 1 write 0 read 0 write 0 clear in error occurrence condition 1 irqaf irqbf occurrence condition 2 10.2.3 timer mode register (tmdr) bit 6 ? phase counting mode flag (mdf) 335 table amended counting direction down-counting up-counting tclka pin (mhz) 3 3.6864 25 bit rate (bits/s) n n error (%) n n error (%) n n error (%) 110 1 212 0.03 2 64 0.70 3 110 ? 0.02 150 1 155 0.16 1 191 0.00 3 80 0.47 300 1 77 0.16 1 95 0.00 2 162 ? 0.15 600 0 155 0.16 0 191 0.00 2 80 0.47 1200 0 77 0.16 0 95 0.00 1 162 ? 0.15 2400 0 38 0.16 0 47 0.00 1 80 0.47 4800 0 19 ? 2.34 0 23 0.00 0 162 ? 0.15 9600 0 9 ? 2.34 0 11 0.00 0 80 0.47 19200 0 4 ? 2.34 0 5 0.00 0 40 ? 0.76 31250 0 2 0.00 0 3 ? 7.84 0 24 0.00 38400 0 1 22.07 0 2 0.00 0 19 1.73 13.3.2 operation in asynchronous mode figure 13.8 example of sci receive operation (8-bit data with parity and one stop bit) 492 figure amended 1 start bit 0 d0 d1 d7 0/1 stop bit 1 data parity bit start bit 0 d0 d1 d7 0/1 stop bit 1 data parity bit 1 idle (mark) state rdrf fer 1 frame framing error, eri request rxi interrupt handler reads data in rdr and clears rdrf flag to 0 rxi request
rev. 3.00 sep 27, 2006 page xi of xxvi item page revision (see manual for details) 13.3.3 multiprocessor communication figure 13.11 example of sci transmit operation (8-bit data with multiprocessor bit and one stop bit) 495 figure amended 1 start bit 0 d0 d1 d7 0/1 stop bit 1 data multi- processor bit start bit 0 d0 d1 d7 0/1 stop bit 1 data 1 idle (mark) state tdre tend txi request txi interrupt handler writes data in tdr and clears tdre flag to 0 1 frame tei request multi- processor bit txi request 13.3.4 synchronous operation clock 500 description amended an internal clock generated by the on-chip baud rate generator or an external clock input from the sck pin can be selected by setting the c/ a bit in smr and the cke1 and cke0 bits in scr. see table 13.9. 14.2.3 serial mode register (smr) bit 7 ? gsm mode (gm) 521 table amended bit 7: gm description 0 using the regular smart card interface mode ? the tend flag is set 12.5 etu after the beginning of the start bit (initial value) ? clock output on/off control only 1 using the gsm mode smart card interface mode ? the tend flag is set 11.0 etu after the beginning of the start bit ? clock output on/off and fixed- (set by scr) high/fixed-low control 18.5.1 flash memory control register 1 (flmcr1) bit 1 ? erase bit (e) 587 note amended note: * do not access flash memory while the e bit is set to 1. section 21 electrical characteristics table 21.1 electrical characteristics of h8/3048 group and h8/3048b group products 653, 654 table amended h8/3048b group item h8/3048 ztat h8/3048 f-one (single power supply) h8/3048b mask rom v pp pin rating yes ? ? absolute maximum ratings flash memory charac- teristics * 4 ? see table 21.11 ?
rev. 3.00 sep 27, 2006 page xii of xxvi item page revision (see manual for details) 21.2 electrical characteristics of h8/3048b (mask rom) 675 to 689 preliminary deleted 21.2.2 dc characteristics table 21.13 dc characteristics (2) 678 conditions amended conditions: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v * 1 , t a = ? 20 c to +75 c (regular specifications), t a = ? 40 c to +85 c (wide-range specifications) b.1 addresses (for h8/3048f-one, h8/3048b mask rom version) 742 note amended note: 4. byte data must be used to access flmcr1, flmcr2, ebr, and ramcr. registers flmcr1, flmcr2, ebr, and ramcr are implemented in the flash memory version only. the mask rom version does not have these registers. b.3 function adcr 829 table amended h8/3048f-one not include this register h8/3048f h8/3048b mask rom version h8/3048ztat h8/3048 mask rom version h8/3047 mask rom version h8/3045 mask rom version h8/3044 mask rom version include this register adcr 829 table amended h8/3048f-one include this register h8/3048f h8/3048b mask rom version h8/3048ztat h8/3048 mask rom version h8/3047 mask rom version h8/3045 mask rom version h8/3044 mask rom version not include this register syscr 833 table amended standby timer select 2 to 0 sts2 0 1 h8/3048f-one h8/3048b mask rom version standby timer waiting time = 8,192 states waiting time = 16,384 states waiting time = 32,768 states waiting time = 65,536 states waiting time = 131,072 states waiting time = 262,144 states bit 6 note: * h8/3048f h8/3048ztat h8/3048 mask rom version h8/3047 mask rom version h8/3045 mask rom version h8/3044 mask rom version sts1 0 1 0 bit 5 sts0 0 1 0 1 1 waiting time = 1,024 states 10 illegal setting * waiting time = 8,192 states waiting time = 16,384 states waiting time = 32,768 states waiting time = 65,536 states waiting time = 131,072 states waiting time = 1,024 states illegal setting illegal setting 1 bit 4 0
rev. 3.00 sep 27, 2006 page xiii of xxvi contents section 1 overview ............................................................................................................. 1 1.1 overview.................................................................................................................... ....... 1 1.2 block diagram ............................................................................................................... ... 6 1.3 pin description............................................................................................................. ..... 7 1.3.1 pin arrangement .................................................................................................. 7 1.3.2 pin assignments in each mode ........................................................................... 9 1.3.3 pin functions ....................................................................................................... 15 1.4 notes on h8/3048f-one (single power supply) ............................................................ 20 1.4.1 voltage application ............................................................................................. 20 1.4.2 product type names and markings..................................................................... 21 1.4.3 differences between h8/3048f and h8/3048f-one .......................................... 21 1.4.4 v cl pin.................................................................................................................. 26 1.4.5 note on changeover to h8/3048 group mask rom version............................. 27 1.5 setting oscillation settling wait time ............................................................................. 28 1.6 notes on crystal resonator connection ........................................................................... 28 section 2 cpu ...................................................................................................................... 29 2.1 overview.................................................................................................................... ....... 29 2.1.1 features................................................................................................................ 29 2.1.2 differences from h8/300 cpu ............................................................................ 30 2.2 cpu operating modes ...................................................................................................... 31 2.3 address space............................................................................................................... .... 32 2.4 register configuration...................................................................................................... 33 2.4.1 overview.............................................................................................................. 33 2.4.2 general registers ................................................................................................. 34 2.4.3 control registers ................................................................................................. 35 2.4.4 initial cpu register values................................................................................. 36 2.5 data formats................................................................................................................ ..... 37 2.5.1 general register data formats ............................................................................ 37 2.5.2 memory data formats ......................................................................................... 39 2.6 instruction set ............................................................................................................. ...... 40 2.6.1 instruction set overview ..................................................................................... 40 2.6.2 instructions and addressing modes ..................................................................... 41 2.6.3 tables of instructions classified by function...................................................... 42 2.6.4 basic instruction formats .................................................................................... 52 2.6.5 notes on use of bit manipulation instructions.................................................... 53 2.7 addressing modes and effective address calculation ..................................................... 54 2.7.1 addressing modes ............................................................................................... 54
rev. 3.00 sep 27, 2006 page xiv of xxvi 2.7.2 effective address calculation ............................................................................. 58 2.8 processing states........................................................................................................... .... 62 2.8.1 overview.............................................................................................................. 62 2.8.2 program execution state...................................................................................... 62 2.8.3 exception-handling state .................................................................................... 63 2.8.4 exception-handling sequences ........................................................................... 64 2.8.5 bus-released state............................................................................................... 65 2.8.6 reset state............................................................................................................ 66 2.8.7 power-down state ............................................................................................... 66 2.9 basic operational timing ................................................................................................. 67 2.9.1 overview.............................................................................................................. 67 2.9.2 on-chip memory access timing........................................................................ 67 2.9.3 on-chip supporting module access timing ...................................................... 68 2.9.4 access to external address space ....................................................................... 69 section 3 mcu operating modes .................................................................................. 71 3.1 overview.................................................................................................................... ....... 71 3.1.1 operating mode selection ................................................................................... 71 3.1.2 register configuration......................................................................................... 72 3.2 mode control register (mdcr) ...................................................................................... 72 3.3 system control register (syscr) ................................................................................... 73 3.4 operating mode descriptions ........................................................................................... 75 3.4.1 mode 1 ................................................................................................................. 75 3.4.2 mode 2 ................................................................................................................. 75 3.4.3 mode 3 ................................................................................................................. 75 3.4.4 mode 4 ................................................................................................................. 76 3.4.5 mode 5 ................................................................................................................. 76 3.4.6 mode 6 ................................................................................................................. 76 3.4.7 mode 7 ................................................................................................................. 76 3.5 pin functions in each operating mode ............................................................................ 77 3.6 memory map in each operating mode ............................................................................ 77 section 4 exception handling ......................................................................................... 81 4.1 overview.................................................................................................................... ....... 81 4.1.1 exception handling types and priority............................................................... 81 4.1.2 exception handling operation............................................................................. 81 4.1.3 exception vector table ....................................................................................... 82 4.2 reset....................................................................................................................... ........... 84 4.2.1 overview.............................................................................................................. 84 4.2.2 reset sequence .................................................................................................... 84 4.2.3 interrupts after reset............................................................................................ 87
rev. 3.00 sep 27, 2006 page xv of xxvi 4.3 interrupts .................................................................................................................. ......... 88 4.4 trap instruction............................................................................................................ ..... 89 4.5 stack status after exception handling.............................................................................. 89 4.6 notes on stack usage ....................................................................................................... 9 0 section 5 interrupt controller .......................................................................................... 91 5.1 overview.................................................................................................................... ....... 91 5.1.1 features................................................................................................................ 91 5.1.2 block diagram..................................................................................................... 92 5.1.3 pin configuration................................................................................................. 93 5.1.4 register configuration......................................................................................... 93 5.2 register descriptions ....................................................................................................... .94 5.2.1 system control register (syscr) ...................................................................... 94 5.2.2 interrupt priority registers a and b (ipra, iprb)............................................. 95 5.2.3 irq status register (isr).................................................................................... 102 5.2.4 irq enable register (ier) .................................................................................. 103 5.2.5 irq sense control register (iscr) .................................................................... 104 5.3 interrupt sources........................................................................................................... .... 105 5.3.1 external interrupts ............................................................................................... 105 5.3.2 internal interrupts................................................................................................. 107 5.3.3 interrupt vector table.......................................................................................... 107 5.4 interrupt operation......................................................................................................... ... 111 5.4.1 interrupt handling process................................................................................... 111 5.4.2 interrupt sequence ............................................................................................... 116 5.4.3 interrupt response time...................................................................................... 117 5.5 usage notes ................................................................................................................. ..... 118 5.5.1 contention between interrupt and interrupt-disabling instruction ...................... 118 5.5.2 instructions that inhibit interrupts ...................................................................... 119 5.5.3 interrupts during eepmov instruction execution.............................................. 119 5.5.4 usage notes on external interrupts ..................................................................... 119 5.5.5 notes on non-maskable interrupts (nmi)........................................................... 121 section 6 bus controller ................................................................................................... 123 6.1 overview.................................................................................................................... ....... 123 6.1.1 features................................................................................................................ 12 3 6.1.2 block diagram..................................................................................................... 124 6.1.3 input/output pins ................................................................................................. 125 6.1.4 register configuration......................................................................................... 126 6.2 register descriptions ....................................................................................................... . 126 6.2.1 bus width control register (abwcr)............................................................... 126 6.2.2 access state control register (astcr) ............................................................. 127
rev. 3.00 sep 27, 2006 page xvi of xxvi 6.2.3 wait control register (wcr).............................................................................. 128 6.2.4 wait state controller enable register (wcer) .................................................. 129 6.2.5 bus release control register (brcr) ................................................................ 130 6.2.6 chip select control register (cscr).................................................................. 132 6.3 operation ................................................................................................................... ....... 133 6.3.1 area division....................................................................................................... 133 6.3.2 chip select signals .............................................................................................. 135 6.3.3 data bus............................................................................................................... 136 6.3.4 bus control signal timing .................................................................................. 137 6.3.5 wait modes.......................................................................................................... 145 6.3.6 interconnections with memory (example) .......................................................... 151 6.3.7 bus arbiter operation.......................................................................................... 153 6.4 usage notes ................................................................................................................. ..... 156 6.4.1 connection to dynamic ram and pseudo-static ram...................................... 156 6.4.2 register write timing ......................................................................................... 156 6.4.3 breq input timing............................................................................................. 158 6.4.4 transition to software standby mode ................................................................ 158 section 7 refresh controller ............................................................................................ 159 7.1 overview.................................................................................................................... ....... 159 7.1.1 features................................................................................................................ 15 9 7.1.2 block diagram..................................................................................................... 161 7.1.3 input/output pins ................................................................................................. 162 7.1.4 register configuration......................................................................................... 162 7.2 register descriptions ....................................................................................................... . 163 7.2.1 refresh control register (rfshcr)................................................................... 163 7.2.2 refresh timer control/status register (rtmcsr) ............................................ 166 7.2.3 refresh timer counter (rtcnt)........................................................................ 168 7.2.4 refresh time constant register (rtcor) ......................................................... 168 7.3 operation ................................................................................................................... ....... 169 7.3.1 overview.............................................................................................................. 169 7.3.2 dram refresh control ....................................................................................... 171 7.3.3 pseudo-static ram refresh control ................................................................... 185 7.3.4 interval timer ...................................................................................................... 190 7.4 interrupt source ............................................................................................................ .... 196 7.5 usage notes ................................................................................................................. ..... 196 section 8 dma controller ................................................................................................ 199 8.1 overview.................................................................................................................... ....... 199 8.1.1 features................................................................................................................ 19 9 8.1.2 block diagram..................................................................................................... 200
rev. 3.00 sep 27, 2006 page xvii of xxvi 8.1.3 functional overview............................................................................................ 201 8.1.4 input/output pins ................................................................................................. 203 8.1.5 register configuration......................................................................................... 203 8.2 register descriptions (short address mode).................................................................... 205 8.2.1 memory address registers (mar) ..................................................................... 205 8.2.2 i/o address registers (ioar) ............................................................................. 206 8.2.3 execute transfer count registers (etcr).......................................................... 206 8.2.4 data transfer control registers (dtcr) ............................................................ 208 8.3 register descriptions (full address mode)...................................................................... 211 8.3.1 memory address registers (mar) ..................................................................... 211 8.3.2 i/o address registers (ioar) ............................................................................. 211 8.3.3 execute transfer count registers (etcr).......................................................... 212 8.3.4 data transfer control registers (dtcr) ............................................................ 214 8.4 operation ................................................................................................................... ....... 220 8.4.1 overview.............................................................................................................. 220 8.4.2 i/o mode.............................................................................................................. 222 8.4.3 idle mode............................................................................................................. 224 8.4.4 repeat mode ........................................................................................................ 227 8.4.5 normal mode....................................................................................................... 231 8.4.6 block transfer mode ........................................................................................... 234 8.4.7 dmac activation................................................................................................ 239 8.4.8 dmac bus cycle ................................................................................................ 241 8.4.9 dmac multiple-channel operation ................................................................... 247 8.4.10 external bus requests, refresh controller, and dmac ..................................... 248 8.4.11 nmi interrupts and dmac.................................................................................. 249 8.4.12 aborting a dma transfer ................................................................................... 250 8.4.13 exiting full address mode.................................................................................. 251 8.4.14 dmac states in reset state, standby modes, and sleep mode ......................... 252 8.5 interrupts .................................................................................................................. ......... 253 8.6 usage notes ................................................................................................................. ..... 254 8.6.1 note on word data transfer................................................................................ 254 8.6.2 dmac self-access ............................................................................................. 254 8.6.3 longword access to memory address registers ................................................ 254 8.6.4 note on full address mode setup....................................................................... 254 8.6.5 note on activating dmac by internal interrupts ............................................... 254 8.6.6 nmi interrupts and block transfer mode ........................................................... 256 8.6.7 memory and i/o address register values .......................................................... 256 8.6.8 bus cycle when transfer is aborted ................................................................... 257 section 9 i/o ports .............................................................................................................. 259 9.1 overview.................................................................................................................... ....... 259
rev. 3.00 sep 27, 2006 page xviii of xxvi 9.2 port 1...................................................................................................................... ........... 263 9.2.1 overview.............................................................................................................. 263 9.2.2 register descriptions ........................................................................................... 264 9.3 port 2...................................................................................................................... ........... 266 9.3.1 overview.............................................................................................................. 266 9.3.2 register descriptions ........................................................................................... 267 9.4 port 3...................................................................................................................... ........... 270 9.4.1 overview.............................................................................................................. 270 9.4.2 register descriptions ........................................................................................... 270 9.5 port 4...................................................................................................................... ........... 272 9.5.1 overview.............................................................................................................. 272 9.5.2 register descriptions ........................................................................................... 273 9.6 port 5...................................................................................................................... ........... 276 9.6.1 overview.............................................................................................................. 276 9.6.2 register descriptions ........................................................................................... 277 9.7 port 6...................................................................................................................... ........... 280 9.7.1 overview.............................................................................................................. 280 9.7.2 register descriptions ........................................................................................... 281 9.8 port 7...................................................................................................................... ........... 284 9.8.1 overview.............................................................................................................. 284 9.8.2 register description............................................................................................. 285 9.9 port 8...................................................................................................................... ........... 286 9.9.1 overview.............................................................................................................. 286 9.9.2 register descriptions ........................................................................................... 287 9.10 port 9..................................................................................................................... ............ 292 9.10.1 overview.............................................................................................................. 292 9.10.2 register descriptions ........................................................................................... 293 9.11 port a..................................................................................................................... ........... 297 9.11.1 overview.............................................................................................................. 297 9.11.2 register descriptions ........................................................................................... 299 9.11.3 pin functions ....................................................................................................... 301 9.12 port b ..................................................................................................................... ........... 309 9.12.1 overview.............................................................................................................. 309 9.12.2 register descriptions ........................................................................................... 311 9.12.3 pin functions ....................................................................................................... 313 section 10 16-bit integrated timer unit (itu) .......................................................... 319 10.1 overview................................................................................................................... ........ 319 10.1.1 features................................................................................................................ 3 19 10.1.2 block diagrams ................................................................................................... 322 10.1.3 input/output pins ................................................................................................. 327
rev. 3.00 sep 27, 2006 page xix of xxvi 10.1.4 register configuration......................................................................................... 328 10.2 register descriptions ...................................................................................................... .. 331 10.2.1 timer start register (tstr)................................................................................ 331 10.2.2 timer synchro register (tsnc) ......................................................................... 332 10.2.3 timer mode register (tmdr) ............................................................................ 334 10.2.4 timer function control register (tfcr)............................................................ 337 10.2.5 timer output master enable register (toer) ................................................... 339 10.2.6 timer output control register (tocr) .............................................................. 341 10.2.7 timer counters (tcnt) ...................................................................................... 342 10.2.8 general registers a, b (gra, grb) .................................................................. 343 10.2.9 buffer registers a, b (bra, brb) ..................................................................... 344 10.2.10 timer control registers (tcr) ........................................................................... 345 10.2.11 timer i/o control register (tior) ..................................................................... 348 10.2.12 timer status register (tsr)................................................................................ 350 10.2.13 timer interrupt enable register (tier) .............................................................. 352 10.3 cpu interface.............................................................................................................. ...... 353 10.3.1 16-bit accessible registers ................................................................................. 353 10.3.2 8-bit accessible registers ................................................................................... 356 10.4 operation .................................................................................................................. ........ 357 10.4.1 overview.............................................................................................................. 357 10.4.2 basic functions.................................................................................................... 359 10.4.3 synchronization ................................................................................................... 367 10.4.4 pwm mode.......................................................................................................... 369 10.4.5 reset-synchronized pwm mode......................................................................... 373 10.4.6 complementary pwm mode ............................................................................... 376 10.4.7 phase counting mode .......................................................................................... 385 10.4.8 buffering.............................................................................................................. 38 7 10.4.9 itu output timing .............................................................................................. 392 10.5 interrupts ................................................................................................................. .......... 395 10.5.1 setting of status flags ......................................................................................... 395 10.5.2 timing of clearing of status flags ...................................................................... 398 10.5.3 interrupt sources and dma controller activation.............................................. 398 10.6 usage notes ................................................................................................................ ...... 400 section 11 programmable timing pattern controller ............................................... 415 11.1 overview................................................................................................................... ........ 415 11.1.1 features................................................................................................................ 4 15 11.1.2 block diagram..................................................................................................... 416 11.1.3 tpc pins .............................................................................................................. 417 11.1.4 registers............................................................................................................... 4 18 11.2 register descriptions ...................................................................................................... .. 419
rev. 3.00 sep 27, 2006 page xx of xxvi 11.2.1 port a data direction register (paddr) ........................................................... 419 11.2.2 port a data register (padr).............................................................................. 419 11.2.3 port b data direction register (pbddr)............................................................ 420 11.2.4 port b data register (pbdr) .............................................................................. 420 11.2.5 next data register a (ndra) ............................................................................ 421 11.2.6 next data register b (ndrb)............................................................................. 423 11.2.7 next data enable register a (ndera).............................................................. 425 11.2.8 next data enable register b (nderb) .............................................................. 426 11.2.9 tpc output control register (tpcr) ................................................................. 427 11.2.10 tpc output mode register (tpmr) ................................................................... 429 11.3 operation .................................................................................................................. ........ 431 11.3.1 overview.............................................................................................................. 431 11.3.2 output timing...................................................................................................... 432 11.3.3 normal tpc output............................................................................................. 433 11.3.4 non-overlapping tpc output ............................................................................. 435 11.3.5 tpc output triggering by input capture ............................................................ 437 11.4 usage notes ................................................................................................................ ...... 438 11.4.1 operation of tpc output pins ............................................................................. 438 11.4.2 note on non-overlapping output........................................................................ 438 section 12 watchdog timer ............................................................................................. 441 12.1 overview................................................................................................................... ........ 441 12.1.1 features................................................................................................................ 4 41 12.1.2 block diagram..................................................................................................... 442 12.1.3 pin configuration................................................................................................. 442 12.1.4 register configuration......................................................................................... 443 12.2 register descriptions ...................................................................................................... .. 443 12.2.1 timer counter (tcnt)........................................................................................ 443 12.2.2 timer control/status register (tcsr)................................................................ 444 12.2.3 reset control/status register (rstcsr) ............................................................ 446 12.2.4 notes on register rewriting ................................................................................ 447 12.3 operation .................................................................................................................. ........ 449 12.3.1 watchdog timer operation ................................................................................. 449 12.3.2 interval timer operation ..................................................................................... 450 12.3.3 timing of setting of overflow flag (ovf)......................................................... 450 12.3.4 timing of setting of watchdog timer reset bit (wrst) .................................. 451 12.4 interrupts ................................................................................................................. .......... 452 12.5 usage notes ................................................................................................................ ...... 452 12.6 notes ...................................................................................................................... ........... 453
rev. 3.00 sep 27, 2006 page xxi of xxvi section 13 serial communication interface ................................................................ 455 13.1 overview................................................................................................................... ........ 455 13.1.1 features................................................................................................................ 4 55 13.1.2 block diagram..................................................................................................... 457 13.1.3 input/output pins ................................................................................................. 458 13.1.4 register configuration......................................................................................... 458 13.2 register descriptions ...................................................................................................... .. 459 13.2.1 receive shift register (rsr) .............................................................................. 459 13.2.2 receive data register (rdr) .............................................................................. 459 13.2.3 transmit shift register (tsr) ............................................................................. 460 13.2.4 transmit data register (tdr)............................................................................. 460 13.2.5 serial mode register (smr)................................................................................ 461 13.2.6 serial control register (scr).............................................................................. 464 13.2.7 serial status register (ssr) ................................................................................ 468 13.2.8 bit rate register (brr) ...................................................................................... 472 13.3 operation .................................................................................................................. ........ 481 13.3.1 overview.............................................................................................................. 481 13.3.2 operation in asynchronous mode ....................................................................... 483 13.3.3 multiprocessor communication........................................................................... 492 13.3.4 synchronous operation........................................................................................ 499 13.4 sci interrupts............................................................................................................. ....... 508 13.5 usage notes ................................................................................................................ ...... 509 section 14 smart card interface ..................................................................................... 515 14.1 overview................................................................................................................... ........ 515 14.1.1 features................................................................................................................ 5 15 14.1.2 block diagram..................................................................................................... 516 14.1.3 input/output pins ................................................................................................. 517 14.1.4 register configuration......................................................................................... 517 14.2 register descriptions ...................................................................................................... .. 518 14.2.1 smart card mode register (scmr) .................................................................... 518 14.2.2 serial status register (ssr) ................................................................................ 519 14.2.3 serial mode register (smr)................................................................................ 521 14.2.4 serial control register (scr).............................................................................. 522 14.3 operation .................................................................................................................. ........ 523 14.3.1 overview.............................................................................................................. 523 14.3.2 pin connections ................................................................................................... 523 14.3.3 data format ......................................................................................................... 524 14.3.4 register settings .................................................................................................. 526 14.3.5 clock.................................................................................................................... 528 14.3.6 transmitting and receiving data ........................................................................ 530
rev. 3.00 sep 27, 2006 page xxii of xxvi 14.4 usage notes ................................................................................................................ ...... 538 section 15 a/d converter ................................................................................................. 541 15.1 overview................................................................................................................... ........ 541 15.1.1 features................................................................................................................ 5 41 15.1.2 block diagram..................................................................................................... 542 15.1.3 input pins ............................................................................................................. 54 3 15.1.4 register configuration......................................................................................... 544 15.2 register descriptions ...................................................................................................... .. 545 15.2.1 a/d data registers a to d (addra to addrd).............................................. 545 15.2.2 a/d control/status register (adcsr) ............................................................... 546 15.2.3 a/d control register (adcr) ............................................................................ 548 15.3 cpu interface.............................................................................................................. ...... 549 15.4 operation .................................................................................................................. ........ 550 15.4.1 single mode (scan = 0) .................................................................................... 550 15.4.2 scan mode (scan = 1)....................................................................................... 552 15.4.3 input sampling and a/d conversion time ......................................................... 554 15.4.4 external trigger input timing............................................................................. 555 15.5 interrupts ................................................................................................................. .......... 556 15.6 usage notes ................................................................................................................ ...... 556 section 16 d/a converter ................................................................................................. 561 16.1 overview ................................................................................................................. ........... 561 16.1.1 features ............................................................................................................... .. 561 16.1.2 block diagram..................................................................................................... 562 16.1.3 input/output pins ................................................................................................. 563 16.1.4 register configuration......................................................................................... 563 16.2 register descriptions ...................................................................................................... .. 564 16.2.1 d/a data registers 0 and 1 (dadr0, dadr1) ................................................. 564 16.2.2 d/a control register (dacr) ............................................................................ 564 16.2.3 d/a standby control register (dastcr).......................................................... 566 16.3 operation .................................................................................................................. ........ 567 16.4 d/a output control ......................................................................................................... . 568 section 17 ram .................................................................................................................. 569 17.1 overview................................................................................................................... ........ 569 17.1.1 block diagram..................................................................................................... 570 17.1.2 register configuration......................................................................................... 570 17.2 system control register (syscr) ................................................................................... 571 17.3 operation .................................................................................................................. ........ 572
rev. 3.00 sep 27, 2006 page xxiii of xxvi section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) ................................................................ 573 18.1 flash memory overview .................................................................................................. 573 18.1.1 notes on h8/3048f-one (single power supply) ............................................... 573 18.1.2 mode pin settings ................................................................................................ 574 18.2 flash memory features..................................................................................................... 5 75 18.2.1 block diagram..................................................................................................... 576 18.2.2 mode transitions ................................................................................................. 576 18.2.3 on-board programming modes........................................................................... 579 18.2.4 flash memory emulation in ram ...................................................................... 581 18.2.5 differences between boot mode and user program mode ................................. 582 18.2.6 block configuration ............................................................................................ 583 18.3 flash memory pin configuration...................................................................................... 583 18.4 flash memory register configuration.............................................................................. 584 18.5 flash memory register descriptions................................................................................ 584 18.5.1 flash memory control register 1 (flmcr1)..................................................... 584 18.5.2 flash memory control register 2 (flmcr2)..................................................... 588 18.5.3 erase block register (ebr) ................................................................................ 589 18.5.4 ram control register (ramcr) ....................................................................... 590 18.6 flash memory on-board programming modes................................................................ 592 18.6.1 boot mode ........................................................................................................... 593 18.6.2 user program mode............................................................................................. 598 18.7 programming/erasing flash memory ............................................................................... 600 18.7.1 program mode ..................................................................................................... 602 18.7.2 program-verify mode.......................................................................................... 603 18.7.3 erase mode .......................................................................................................... 607 18.7.4 erase-verify mode .............................................................................................. 607 18.8 flash memory protection.................................................................................................. 60 9 18.8.1 hardware protection ............................................................................................ 609 18.8.2 software protection.............................................................................................. 611 18.8.3 error protection.................................................................................................... 612 18.8.4 nmi input disable conditions............................................................................. 614 18.9 flash memory emulation in ram ................................................................................... 615 18.10 flash memory prom mode............................................................................................. 616 18.10.1 socket adapters and memory map ..................................................................... 617 18.10.2 notes on use of prom mode ............................................................................. 618 18.11 notes on flash memory programming/erasing................................................................ 619 18.12 mask rom (h8/3048b mask rom version) overviews................................................ 625 18.12.1 block diagram..................................................................................................... 625 18.13 notes on ordering mask rom version chips ................................................................. 626
rev. 3.00 sep 27, 2006 page xxiv of xxvi 18.14 notes when converting the f-ztat (single power supply) application software to the mask-rom versions .............................................................................................. 627 section 19 clock pulse generator .................................................................................. 629 19.1 overview................................................................................................................... ........ 629 19.1.1 block diagram..................................................................................................... 630 19.2 oscillator circuit......................................................................................................... ...... 630 19.2.1 connecting a crystal resonator........................................................................... 630 19.2.2 external clock input ............................................................................................ 633 19.3 duty adjustment circuit................................................................................................... 6 36 19.4 prescalers ................................................................................................................. ......... 636 19.5 frequency divider .......................................................................................................... .. 636 19.5.1 register configuration......................................................................................... 637 19.5.2 division control register (divcr) .................................................................... 637 19.5.3 usage notes ......................................................................................................... 638 section 20 power-down state ......................................................................................... 639 20.1 overview................................................................................................................... ........ 639 20.2 register configuration..................................................................................................... . 641 20.2.1 system control register (syscr) ...................................................................... 641 20.2.2 module standby control register (mstcr)....................................................... 643 20.3 sleep mode ................................................................................................................. ...... 645 20.3.1 transition to sleep mode..................................................................................... 645 20.3.2 exit from sleep mode.......................................................................................... 645 20.4 software standby mode.................................................................................................... 64 5 20.4.1 transition to software standby mode ................................................................. 645 20.4.2 exit from software standby mode ...................................................................... 646 20.4.3 selection of waiting time for exit from software standby mode...................... 646 20.4.4 sample application of software standby mode.................................................. 648 20.4.5 note..................................................................................................................... . 648 20.5 hardware standby mode .................................................................................................. 649 20.5.1 transition to hardware standby mode ................................................................ 649 20.5.2 exit from hardware standby mode ..................................................................... 649 20.5.3 timing for hardware standby mode ................................................................... 649 20.6 module standby function................................................................................................. 650 20.6.1 module standby timing ...................................................................................... 650 20.6.2 read/write in module standby............................................................................ 650 20.6.3 usage notes ......................................................................................................... 651 20.7 system clock output disabling function......................................................................... 652
rev. 3.00 sep 27, 2006 page xxv of xxvi section 21 electrical characteristics .............................................................................. 653 21.1 electrical characteristics of h8/3048f-one (single-power supply) .............................. 655 21.1.1 absolute maximum ratings ................................................................................ 655 21.1.2 dc characteristics ............................................................................................... 656 21.1.3 ac characteristics ............................................................................................... 663 21.1.4 a/d conversion characteristics........................................................................... 669 21.1.5 d/a conversion characteristics........................................................................... 670 21.1.6 flash memory characteristics ............................................................................. 671 21.2 electrical characteristics of h8/3048b (mask rom) ...................................................... 675 21.2.1 absolute maximum ratings ................................................................................ 675 21.2.2 dc characteristics ............................................................................................... 676 21.2.3 ac characteristics ............................................................................................... 682 21.2.4 a/d conversion characteristics........................................................................... 688 21.2.5 d/a conversion characteristics........................................................................... 689 21.3 operational timing......................................................................................................... .. 690 21.3.1 bus timing .......................................................................................................... 690 21.3.2 refresh controller bus timing............................................................................ 694 21.3.3 control signal timing ......................................................................................... 699 21.3.4 clock timing ....................................................................................................... 701 21.3.5 tpc and i/o port timing..................................................................................... 701 21.3.6 itu timing .......................................................................................................... 702 21.3.7 sci input/output timing..................................................................................... 703 21.3.8 dmac timing..................................................................................................... 704 appendix a instruction set .............................................................................................. 705 a.1 instruction list ............................................................................................................ ...... 705 a.2 operation code map......................................................................................................... 7 20 a.3 number of states required for execution ........................................................................ 723 appendix b internal i/o register ................................................................................... 734 b.1 addresses (for h8/3048f-one, h8/3048b mask rom version) .................................. 735 b.2 addresses (for h8/3048f, h8/3048ztat, h8/3048 mask-rom, h8/3047 mask-rom, h8/3045 mask-rom, and h8/3044 mask-rom versions) ............................................. 743 b.3 function .................................................................................................................... ........ 751 appendix c i/o port block diagrams ........................................................................... 837 c.1 port 1 block diagram ....................................................................................................... 8 37 c.2 port 2 block diagram ....................................................................................................... 8 38 c.3 port 3 block diagram ....................................................................................................... 8 39 c.4 port 4 block diagram ....................................................................................................... 8 40 c.5 port 5 block diagram ....................................................................................................... 8 41
rev. 3.00 sep 27, 2006 page xxvi of xxvi c.6 port 6 block diagrams...................................................................................................... 8 42 c.7 port 7 block diagrams...................................................................................................... 8 46 c.8 port 8 block diagrams...................................................................................................... 8 47 c.9 port 9 block diagrams...................................................................................................... 8 50 c.10 port a block diagrams ..................................................................................................... 8 54 c.11 port b block diagrams ..................................................................................................... 8 58 appendix d pin states ....................................................................................................... 862 d.1 port states in each mode .................................................................................................. 86 2 d.2 pin states at reset ......................................................................................................... .... 865 appendix e timing of transition to and recovery from hardware standby mode ............................................................................................... 868 appendix f product code lineup .................................................................................. 869 appendix g package dimensions ................................................................................... 871
section 1 overview rev. 3.00 sep 27, 2006 page 1 of 872 rej09b0325-0300 section 1 overview 1.1 overview the h8/3048b group is a series of microcontrollers (mcus) that integrate system supporting functions together with an h8/300h cpu core having an original renesas technology architecture. in addition, the h8/3048f-one is equipped with an on-chip emulator (e10t) * 2 . the h8/300h cpu has a 32-bit internal architecture with sixteen 16-bit general registers, and a concise, optimized instruction set designed for speed. it can address a 16-mbyte linear address space. its instruction set is upward-compatible at the object-code level with the h8/300 cpu, enabling easy porting of software from the h8/300 series. the on-chip system supporting functions include rom, ram, a 16-bit integrated timer unit (itu), a programmable timing pattern controller (tpc), a watchdog timer (wdt), a serial communication interface (sci), an a/d converter, a d/a converter, i/o ports, a direct memory access controller (dmac), a refresh controller, and other facilities. the h8/3048b group has 128 kbytes of on-chip rom and 4 kbytes of on-chip ram. seven mcu operating modes offer a choice of data bus width and address space size. the modes (modes 1 to 7) include one single-chip mode and six expanded modes. in addition to mask rom products, the h8/3048b group includes f-ztat? * 1 version products with on-chip user-programmable flash memory. it enables users to respond quickly and flexibly to changing application specifications as well as to conditions when ramping up from initial to full volume production. the on-chip emulator (e10t) * 2 is capable of direct emulation of the microcontroller when mounted in the user?s system, thereby making possible on-board program debugging. table 1.1 summarizes the features of the h8/3048b group. notes: 1. f-ztat (flexible ztat ? ) is a trademark of renesas technology corp. 2. an on-chip emulator (e10t) is not provided in the mask rom version.
section 1 overview rev. 3.00 sep 27, 2006 page 2 of 872 rej09b0325-0300 table 1.1 features feature description cpu upward-compatible with the h8/300 cpu at the object-code level ? general-register machine ? sixteen 16-bit general registers (also usable as sixteen 8-bit registers + eight 16-bit registers or eight 32- bit registers) ? high-speed operation (flash memory version) ? maximum clock rate: 25 mhz ? add/subtract: 80 ns ? multiply/divide: 560 ns ? 16-mbyte address space ? instruction features ? 8/16/32-bit data transfer, arithmetic, and logic instructions ? signed and unsigned multiply instructions (8 bits 8 bits, 16 bits 16 bits) ? signed and unsigned divide instructions (16 bits 8 bits, 32 bits 16 bits) ? bit accumulator function ? bit manipulation instructions with register-indirect specification of bit positions memory ? rom: 128 kbytes ? ram: 4 kbytes interrupt controller ? seven external interrupt pins: nmi, irq 0 to irq 5 ? 30 internal interrupts ? three selectable interrupt priority levels bus controller ? address space can be partitioned into eight areas, with independent bus specifications in each area ? chip select output available for areas 0 to 7 ? 8-bit access or 16-bit access selectable for each area ? two-state or three-state access selectable for each area ? selection of four wait modes ? bus arbitration function
section 1 overview rev. 3.00 sep 27, 2006 page 3 of 872 rej09b0325-0300 feature description refresh controller ? dram refresh ? directly connectable to 16-bit-wide dram ? cas-before-ras refresh ? self-refresh mode selectable ? pseudo-static ram refresh ? self-refresh mode selectable ? usable as an interval timer dma controller (dmac) ? short address mode ? maximum four channels available ? selection of i/o mode, idle mode, or repeat mode ? can be activated by compare match/input capture a interrupts from itu channels 0 to 3, transmit-data-empty and receive-data-full interrupts from sci channel 0, or external requests ? full address mode ? maximum two channels available ? selection of normal mode or block transfer mode ? can be activated by compare match/input capture a interrupts from itu channels 0 to 3, external requests, or auto-request 16-bit integrated timer unit (itu) ? five 16-bit timer channels, capable of processing up to 12 pulse outputs or 10 pulse inputs ? one 16-bit timer counter (channels 0 to 4) ? two multiplexed output compare/input capture pins (channels 0 to 4) ? operation can be synchronized (channels 0 to 4) ? pwm mode available (channels 0 to 4) ? phase counting mode available (channel 2) ? buffering available (channels 3 and 4) ? reset-synchronized pwm mode available (channels 3 and 4) ? complementary pwm mode available (channels 3 and 4) ? dmac can be activated by compare match/input capture a interrupts (channels 0 to 3)
section 1 overview rev. 3.00 sep 27, 2006 page 4 of 872 rej09b0325-0300 feature description programmable timing pattern controller (tpc) ? maximum 16-bit pulse output, using itu as time base ? up to four 4-bit pulse output groups (or one 16-bit group, or two 8-bit groups) ? non-overlap mode available ? output data can be transferred by dmac watchdog timer (wdt), 1 channel ? reset signal can be generated by overflow ? usable as an interval timer serial communication interface (sci), 2 channels ? selection of asynchronous or synchronous mode ? full duplex: can transmit and receive simultaneously ? on-chip baud-rate generator ? smart card interface functions added (sci0 only) a/d converter ? resolution: 10 bits ? eight channels, with selection of single or scan mode ? variable analog conversion voltage range ? sample-and-hold function ? a/d conversion can be externally triggered d/a converter ? resolution: 8 bits ? two channels ? d/a outputs can be sustained in software standby mode i/o ports ? 70 input/output pins ? 8 input-only pins ? seven mcu operating modes mode address space address pins initial bus width max. bus width mode 1 1 mbyte a 19 to a 0 8 bits 16 bits mode 2 1 mbyte a 19 to a 0 16 bits 16 bits mode 3 16 mbytes a 23 to a 0 8 bits 16 bits mode 4 16 mbytes a 23 to a 0 16 bits 16 bits mode 5 1 mbyte a 19 to a 0 8 bits 16 bits mode 6 16 mbytes a 23 to a 0 8 bits 16 bits mode 7 1 mbyte ? ? ? operating modes ? on-chip rom is disabled in modes 1 to 4
section 1 overview rev. 3.00 sep 27, 2006 page 5 of 872 rej09b0325-0300 feature description power-down state ? sleep mode ? software standby mode ? hardware standby mode ? module standby function ? programmable system clock frequency division other features ? on-chip clock pulse generator product lineup model (5 v) model (3 v) package rom remarks hd64f3048bte hd64f3048bvte 100-pin tqfp (tfp-100b) hd64f3048bf hd64f3048bvf 100-pin qfp (fp-100b) flash memory e10t is installed hd6433048bte hd6433048bvte 100-pin tqfp (tfp-100b) hd6433048bf hd6433048bvf 100-pin qfp (fp-100b) mask rom e10t is not installed
section 1 overview rev. 3.00 sep 27, 2006 page 6 of 872 rej09b0325-0300 1.2 block diagram figure 1.1 shows an internal block diagram. v cc * 2 v cc v cc v ss v ss v ss v ss v ss v ss p3 7 /d 15 p3 6 /d 14 p3 5 /d 13 p3 4 /d 12 p3 3 /d 11 p3 2 /d 10 p3 1 /d 9 p3 0 /d 8 p4 7 /d 7 p4 6 /d 6 p4 5 /d 5 p4 4 /d 4 p4 3 /d 3 p4 2 /d 2 p4 1 /d 1 p4 0 /d 0 port 3 port 4 port 5 port 9 p5 3 /a 19 p5 2 /a 18 p5 1 /a 17 p5 0 /a 16 p2 7 /a 15 p2 6 /a 14 p2 5 /a 13 p2 4 /a 12 p2 3 /a 11 p2 2 /a 10 p2 1 /a 9 p2 0 /a 8 p9 5 /sck 1 / irq 5 p9 4 /sck 0 / irq 4 p9 3 /rxd 1 p9 2 /rxd 0 p9 1 /txd 1 p9 0 /txd 0 p7 7 /an 7 /da 1 p7 6 /an 6 /da 0 p7 5 /an 5 p7 4 /an 4 p7 3 /an 3 p7 2 /an 2 p7 1 /an 1 p7 0 /an 0 port 7 v ref av cc av ss pa 7 /tp 7 /tiocb 2 /a 20 pa 6 /tp 6 /tioca 2 /a 21 / cs 4 pa 5 /tp 5 /tiocb 1 /a 22 / cs 5 pa 4 /tp 4 /tioca 1 /a 23 / cs 6 pa 3 /tp 3 /tiocb 0 /tclkd pa 2 /tp 2 /tioca 0 /tclkc pa 1 /tp 1 / tend 1 /tclkb pa 0 /tp 0 / tend 0 /tclka port a pb 7 /tp 15 / dreq 1 / adtrg pb 6 /tp 14 / dreq 0 / cs 7 pb 5 /tp 13 /tocxb 4 pb 4 /tp 12 /tocxa 4 pb 3 /tp 11 /tiocb 4 pb 2 /tp 10 /tioca 4 pb 1 /tp 9 /tiocb 3 pb 0 /tp 8 /tioca 3 port 8 p8 4 / cs 0 p8 3 / cs 1 / irq 3 p8 2 / cs 2 / irq 2 p8 1 / cs 3 / irq 1 p8 0 / rfsh / irq 0 md 2 md 1 md 0 extal xtal stby res reso /fwe * 1 nmi h8/300h cpu clock pulse generator interrupt controller rom (mask rom, or flash memory) dma controller (dmac) serial communication interface (sci) 2 channels lwr p6 5 / hwr p6 4 / rd p6 3 / as p6 2 / back p6 1 / breq p6 0 / wait ram 16-bit integrated timer unit (itu) a/d converter d/a converter port 6 bus controller programmable timing pattern controller (tpc) port b notes: 1. this pin functions as the fwe (input) pin on the h8/3048f-one (single power supply on-chip flash memory version). on h8/300h series versions with on-chip mask rom it functions as the reso (output) pin, and on dual power supply flash memory versions (v pp = 12 v) and on-chip prom versions it functions as the reso (output)/v pp (input) pin. 2. pin 1 on the h8/3048b group which operates at 5 v is not used as the v cc terminal, but is used as the v cl terminal; the external capacitor must be connected. pin 1 is the v cc pin on versions that operate on 3 v. figure 1.1 block diagram
section 1 overview rev. 3.00 sep 27, 2006 page 7 of 872 rej09b0325-0300 1.3 pin description 1.3.1 pin arrangement figure 1.3 shows the pin arrangement of the h8/3048b group. the pin arrangement of the h8/3048b group is shown in figure 1.3. differences in the h8/3048 group pin arrangements are shown in table 1.2. the 5 v operation models of the h8/3048b group have a v cl pin. the 3 v operation models of the h8/3048b group have pin 1, which is the v cc power supply pin. see section 1.4, notes on h8/3048f-one (single power supply). except for the differences shown in table 1.2, the pin arrangements are the same. table 1.2 comparison of h8/3048b group and h8/3048 group pin arrangements h8/3048f-one package pin number h8/3048b mask rom version 1 10 5 v operation model v cl fwe fp-100b (tfp-100b) h8/3048f v pp / reso v cc h8/3048 ztat v pp / reso v cc h8/3048 mask rom version reso v cc h8/3047 mask rom version reso v cc h8/3045 mask rom version reso v cc h8/3044 mask rom version reso v cc fwe v cc 3 v operation model reso v cl 5 v operation model reso v cc 3 v operation model 1 (v cl ) 1 (v cc ) v cc h8/3048b group and h8/3048f-one 5 v operation model h8/3048b group and h8/3048f-one 3 v operation model and h8/3048 group figure 1.2 connection of pin 1
section 1 overview rev. 3.00 sep 27, 2006 page 8 of 872 rej09b0325-0300 v cc /v cl * 1 tioca /tp /pb tiocb /tp /pb tioca /tp /pb tiocb /tp /pb tocxa /tp /pb tocxb /tp /pb cs 7 / dreq /tp /pb adtrg / dreq /tp /pb fwe * 2 v txd /p9 txd /p9 rxd /p9 rxd /p9 irq /sck /p9 irq /sck /p9 d /p4 d /p4 d /p4 d /p4 v d /p4 d /p4 d /p4 md md md p6 / lwr p6 / hwr p6 / rd p6 / as v xtal extal v nmi res stby back p6 / bre q p6 / wait v p5 /a p5 /a p5 /a p5 /a p2 /a p2 /a 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 av cc v ref p7 0 /an 0 p7 1 /an 1 p7 2 /an 2 p7 3 /an 3 p7 4 /an 4 p7 5 /an 5 p7 6 /an 6 /da 0 p7 7 /an 7 /da 1 av ss p8 0 / rfsh / irq 0 p8 1 / cs 3 / irq 1 p8 2 / cs 2 / irq 2 p8 3 / cs 1 / irq 3 p8 4 / cs 0 v ss pa 0 /tp 0 / tend 0 /tclka pa 1 /tp 1 / tend 1 /tclkb pa 2 /tp 2 /tioca 0 /tclkc pa 3 /tp 3 /tiocb 0 /tclkd pa 4 /tp 4 /tioca 1 /a 23 / cs 6 pa 5 /tp 5 /tiocb 1 /a 22 / cs 5 pa 6 /tp 6 /tioca 2 /a 21 / cs 4 pa 7 /tp 7 /tiocb 2 /a 20 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 a 13 /p2 5 a 12 /p2 4 a 11 /p2 3 a 10 /p2 2 a 9 /p2 1 a 8 /p2 0 v ss a 7 /p1 7 a 6 /p1 6 a 5 /p1 5 a 4 /p1 4 a 3 /p1 3 a 2 /p1 2 a 1 /p1 1 a 0 /p1 0 v cc d 15 /p3 7 d 14 /p3 6 d 13 /p3 5 d 12 /p3 4 d 11 /p3 3 d 10 /p3 2 d 9 /p3 1 d 8 /p3 0 d 7 /p4 7 0 1 2 3 4 5 6 7 ss 0 1 2 3 4 5 0 1 2 3 ss 4 5 6 8 9 10 11 12 13 14 15 0 1 0 1 0 1 0 1 0 1 2 3 4 5 6 4 5 2 1 0 2 1 0 3 2 1 0 7 6 top view (fp-100b, tfp-100b) 6 5 4 3 cc ss ss 19 18 17 16 15 14 3 3 4 4 4 4 reso / notes: 1. for the 5 v operation product, this pin is used as the v cl terminal, and for the 3 v operation models, this pin is used as the v cc terminal that requires an external capacitor. 2. (1) pin 10 of the h8/3048f-one (single power supply version) functions as the fwe pin. the h8/3048f-one has no reso output. pin 10 functions as the reso pin in on-chip mask rom versions and as the reso /v pp pin in on-chip prom versions and dual power supply flash memory versions. (2) do not apply 12 v to the h8/3048f-one (single power supply), or to h8/3048 group or h8/3048b group mask rom products as the chip will be destroyed. 1 0.1 figure 1.3 h8/3048b group pin arrangement (fp-100b or tfp-100b, top view)
section 1 overview rev. 3.00 sep 27, 2006 page 9 of 872 rej09b0325-0300 1.3.2 pin assignments in each mode table 1.3 lists the pin assignments in each mode. table 1.3 pin assignments in each mode (fp-100b or tfp-100b) pin name prom mode pin no. mode 1 mode 2 mode 3 mode 4 mode 5 mode 6 mode 7 eprom flash remarks 1 * 3 v cl (v cc )v cl (v cc )v cl (v cc )v cl (v cc )v cl (v cc )v cl (v cc )v cl (v cc ) ? v cl (v cc ) flash memory version with single power supply. h8/3048 b mask- rom version v cc v cc v cc v cc v cc v cc v cc v cc v cc h8/3048 group, mask rom version, prom version and flash memory version with dual power supply. 2pb 0 /tp 8 / tioca 3 pb 0 /tp 8 / tioca 3 pb 0 /tp 8 / tioca 3 pb 0 /tp 8 / tioca 3 pb 0 /tp 8 / tioca 3 pb 0 /tp 8 / tioca 3 pb 0 /tp 8 / tioca 3 nc nc 3pb 1 /tp 9 / tiocb 3 pb 1 /tp 9 / tiocb 3 pb 1 /tp 9 / tiocb 3 pb 1 /tp 9 / tiocb 3 pb 1 /tp 9 / tiocb 3 pb 1 /tp 9 / tiocb 3 pb 1 /tp 9 / tiocb 3 nc nc 4pb 2 /tp 10 / tioca 4 pb 2 /tp 10 / tioca 4 pb 2 /tp 10 / tioca 4 pb 2 /tp 10 / tioca 4 pb 2 /tp 10 / tioca 4 pb 2 /tp 10 / tioca 4 pb 2 /tp 10 / tioca 4 nc nc 5pb 3 /tp 11 / tiocb 4 pb 3 /tp 11 / tiocb 4 pb 3 /tp 11 / tiocb 4 pb 3 /tp 11 / tiocb 4 pb 3 /tp 11 / tiocb 4 pb 3 /tp 11 / tiocb 4 pb 3 /tp 11 / tiocb 4 nc nc 6pb 4 /tp 12 / tocxa 4 pb 4 /tp 12 / tocxa 4 pb 4 /tp 12 / tocxa 4 pb 4 /tp 12 / tocxa 4 pb 4 /tp 12 / tocxa 4 pb 4 /tp 12 / tocxa 4 pb 4 /tp 12 / tocxa 4 nc nc 7pb 5 /tp 13 / tocxb 4 pb 5 /tp 13 / tocxb 4 pb 5 /tp 13 / tocxb 4 pb 5 /tp 13 / tocxb 4 pb 5 /tp 13 / tocxb 4 pb 5 /tp 13 / tocxb 4 pb 5 /tp 13 / tocxb 4 nc nc
section 1 overview rev. 3.00 sep 27, 2006 page 10 of 872 rej09b0325-0300 pin name prom mode pin no. mode 1 mode 2 mode 3 mode 4 mode 5 mode 6 mode 7 eprom flash remarks 8pb 6 /tp 14 / dreq 0 / cs 7 pb 6 /tp 14 / dreq 0 / cs 7 pb 6 /tp 14 / dreq 0 / cs 7 pb 6 /tp 14 / dreq 0 / cs 7 pb 6 /tp 14 / dreq 0 / cs 7 pb 6 /tp 14 / dreq 0 / cs 7 pb 6 /tp 14 / dreq 0 nc nc 9pb 7 /tp 15 / dreq 1 / adtrg pb 7 /tp 15 / dreq 1 / adtrg pb 7 /tp 15 / dreq 1 / adtrg pb 7 /tp 15 / dreq 1 / adtrg pb 7 /tp 15 / dreq 1 / adtrg pb 7 /tp 15 / dreq 1 / adtrg pb 7 /tp 15 / dreq 1 / adtrg nc nc 10 * 4 fwe fwe fwe fwe fwe fwe fwe ? fwe flash memory version with single power supply. reso reso reso reso reso reso reso v pp v pp mask rom version, prom version and flash memory version with dual power supply. 11 v ss v ss v ss v ss v ss v ss v ss v ss v ss 12 p9 0 /txd 0 p9 0 /txd 0 p9 0 /txd 0 p9 0 /txd 0 p9 0 /txd 0 p9 0 /txd 0 p9 0 /txd 0 nc nc 13 p9 1 /txd 1 p9 1 /txd 1 p9 1 /txd 1 p9 1 /txd 1 p9 1 /txd 1 p9 1 /txd 1 p9 1 /txd 1 nc nc 14 p9 2 /rxd 0 p9 2 /rxd 0 p9 2 /rxd 0 p9 2 /rxd 0 p9 2 /rxd 0 p9 2 /rxd 0 p9 2 /rxd 0 nc nc 15 p9 3 /rxd 1 p9 3 /rxd 1 p9 3 /rxd 1 p9 3 /rxd 1 p9 3 /rxd 1 p9 3 /rxd 1 p9 3 /rxd 1 nc nc 16 p9 4 /sck 0 / irq 4 p9 4 /sck 0 / irq 4 p9 4 /sck 0 / irq 4 p9 4 /sck 0 / irq 4 p9 4 /sck 0 / irq 4 p9 4 /sck 0 / irq 4 p9 4 /sck 0 / irq 4 nc nc 17 p9 5 /sck 1 / irq 5 p9 5 /sck 1 / irq 5 p9 5 /sck 1 / irq 5 p9 5 /sck 1 / irq 5 p9 5 /sck 1 / irq 5 p9 5 /sck 1 / irq 5 p9 5 /sck 1 / irq 5 nc nc 18 p4 0 /d 0 * 1 p4 0 /d 0 * 2 p4 0 /d 0 * 1 p4 0 /d 0 * 2 p4 0 /d 0 * 1 p4 0 /d 0 * 1 p4 0 nc nc 19 p4 1 /d 1 * 1 p4 1 /d 1 * 2 p4 1 /d 1 * 1 p4 1 /d 1 * 2 p4 1 /d 1 * 1 p4 1 /d 1 * 1 p4 1 nc nc 20 p4 2 /d 2 * 1 p4 2 /d 2 * 2 p4 2 /d 2 * 1 p4 2 /d 2 * 2 p4 2 /d 2 * 1 p4 2 /d 2 * 1 p4 2 nc nc 21 p4 3 /d 3 * 1 p4 3 /d 3 * 2 p4 3 /d 3 * 1 p4 3 /d 3 * 2 p4 3 /d 3 * 1 p4 3 /d 3 * 1 p4 3 nc nc 22 v ss v ss v ss v ss v ss v ss v ss v ss v ss
section 1 overview rev. 3.00 sep 27, 2006 page 11 of 872 rej09b0325-0300 pin name prom mode pin no. mode 1 mode 2 mode 3 mode 4 mode 5 mode 6 mode 7 eprom flash remarks 23 p4 4 /d 4 * 1 p4 4 /d 4 * 2 p4 4 /d 4 * 1 p4 4 /d 4 * 2 p4 4 /d 4 * 1 p4 4 /d 4 * 1 p4 4 nc nc 24 p4 5 /d 5 * 1 p4 5 /d 5 * 2 p4 5 /d 5 * 1 p4 5 /d 5 * 2 p4 5 /d 5 * 1 p4 5 /d 5 * 1 p4 5 nc nc 25 p4 6 /d 6 * 1 p4 6 /d 6 * 2 p4 6 /d 6 * 1 p4 6 /d 6 * 2 p4 6 /d 6 * 1 p4 6 /d 6 * 1 p4 6 nc nc 26 p4 7 /d 7 * 1 p4 7 /d 7 * 2 p4 7 /d 7 * 1 p4 7 /d 7 * 2 p4 7 /d 7 * 1 p4 7 /d 7 * 1 p4 7 nc nc 27 d 8 d 8 d 8 d 8 d 8 d 8 p3 0 eo 0 i/o 0 28 d 9 d 9 d 9 d 9 d 9 d 9 p3 1 eo 1 i/o 1 29 d 10 d 10 d 10 d 10 d 10 d 10 p3 2 eo 2 i/o 2 30 d 11 d 11 d 11 d 11 d 11 d 11 p3 3 eo 3 i/o 3 31 d 12 d 12 d 12 d 12 d 12 d 12 p3 4 eo 4 i/o 4 32 d 13 d 13 d 13 d 13 d 13 d 13 p3 5 eo 5 i/o 5 33 d 14 d 14 d 14 d 14 d 14 d 14 p3 6 eo 6 i/o 6 34 d 15 d 15 d 15 d 15 d 15 d 15 p3 7 eo 7 i/o 7 35 v cc v cc v cc v cc v cc v cc v cc v cc v cc 36 a 0 a 0 a 0 a 0 p1 0 /a 0 p1 0 /a 0 p1 0 ea 0 a 0 37 a 1 a 1 a 1 a 1 p1 1 /a 1 p1 1 /a 1 p1 1 ea 1 a 1 38 a 2 a 2 a 2 a 2 p1 2 /a 2 p1 2 /a 2 p1 2 ea 2 a 2 39 a 3 a 3 a 3 a 3 p1 3 /a 3 p1 3 /a 3 p1 3 ea 3 a 3 40 a 4 a 4 a 4 a 4 p1 4 /a 4 p1 4 /a 4 p1 4 ea 4 a 4 41 a 5 a 5 a 5 a 5 p1 5 /a 5 p1 5 /a 5 p1 5 ea 5 a 5 42 a 6 a 6 a 6 a 6 p1 6 /a 6 p1 6 /a 6 p1 6 ea 6 a 6 43 a 7 a 7 a 7 a 7 p1 7 /a 7 p1 7 /a 7 p1 7 ea 7 a 7 44 v ss v ss v ss v ss v ss v ss v ss v ss v ss 45 a 8 a 8 a 8 a 8 p2 0 /a 8 p2 0 /a 8 p2 0 ea 8 a 8 46 a 9 a 9 a 9 a 9 p2 1 /a 9 p2 1 /a 9 p2 1 oe oe 47 a 10 a 10 a 10 a 10 p2 2 /a 10 p2 2 /a 10 p2 2 ea 10 a 10 48 a 11 a 11 a 11 a 11 p2 3 /a 11 p2 3 /a 11 p2 3 ea 11 a 11 49 a 12 a 12 a 12 a 12 p2 4 /a 12 p2 4 /a 12 p2 4 ea 12 a 12 50 a 13 a 13 a 13 a 13 p2 5 /a 13 p2 5 /a 13 p2 5 ea 13 a 13 51 a 14 a 14 a 14 a 14 p2 6 /a 14 p2 6 /a 14 p2 6 ea 14 a 14 52 a 15 a 15 a 15 a 15 p2 7 /a 15 p2 7 /a 15 p2 7 ce ce 53 a 16 a 16 a 16 a 16 p5 0 /a 16 p5 0 /a 16 p5 0 v cc v cc 54 a 17 a 17 a 17 a 17 p5 1 /a 17 p5 1 /a 17 p5 1 v cc v cc
section 1 overview rev. 3.00 sep 27, 2006 page 12 of 872 rej09b0325-0300 pin name prom mode pin no. mode 1 mode 2 mode 3 mode 4 mode 5 mode 6 mode 7 eprom flash remarks 55 a 18 a 18 a 18 a 18 p5 2 /a 18 p5 2 /a 18 p5 2 nc nc 56 a 19 a 19 a 19 a 19 p5 3 /a 19 p5 3 /a 19 p5 3 nc nc 57 v ss v ss v ss v ss v ss v ss v ss v ss v ss 58 p6 0 / wait p6 0 / wait p6 0 / wait p6 0 / wait p6 0 / wait p6 0 / wait p6 0 ea 15 a 15 59 p6 1 / breq p6 1 / breq p6 1 / breq p6 1 / breq p6 1 / breq p6 1 / breq p6 1 nc nc 60 p6 2 / back p6 2 / back p6 2 / back p6 2 / back p6 2 / back p6 2 / back p6 2 nc nc 61 ?????? stby stby stby stby stby stby stby v ss v cc 63 res res res res res res res nc res 64 nmi nmi nmi nmi nmi nmi nmi ea 9 a 9 65 v ss v ss v ss v ss v ss v ss v ss v ss v ss 66 extal extal extal extal extal extal extal nc extal 67 xtal xtal xtal xtal xtal xtal xtal nc xtal 68 v cc v cc v cc v cc v cc v cc v cc v cc v cc 69 as as as as as as p6 3 nc a 16 70 rd rd rd rd rd rd p6 4 nc nc 71 hwr hwr hwr hwr hwr hwr p6 5 nc v cc 72 lwr lwr lwr lwr lwr lwr p6 6 nc nc 73 md 0 md 0 md 0 md 0 md 0 md 0 md 0 v ss v ss 74 md 1 md 1 md 1 md 1 md 1 md 1 md 1 v ss v ss 75 md 2 md 2 md 2 md 2 md 2 md 2 md 2 v ss v ss 76 av cc av cc av cc av cc av cc av cc av cc v cc v cc 77 v ref v ref v ref v ref v ref v ref v ref v cc v cc 78 p7 0 /an 0 p7 0 /an 0 p7 0 /an 0 p7 0 /an 0 p7 0 /an 0 p7 0 /an 0 p7 0 /an 0 nc nc 79 p7 1 /an 1 p7 1 /an 1 p7 1 /an 1 p7 1 /an 1 p7 1 /an 1 p7 1 /an 1 p7 1 /an 1 nc nc 80 p7 2 /an 2 p7 2 /an 2 p7 2 /an 2 p7 2 /an 2 p7 2 /an 2 p7 2 /an 2 p7 2 /an 2 nc nc 81 p7 3 /an 3 p7 3 /an 3 p7 3 /an 3 p7 3 /an 3 p7 3 /an 3 p7 3 /an 3 p7 3 /an 3 nc nc 82 p7 4 /an 4 p7 4 /an 4 p7 4 /an 4 p7 4 /an 4 p7 4 /an 4 p7 4 /an 4 p7 4 /an 4 nc nc 83 p7 5 /an 5 p7 5 /an 5 p7 5 /an 5 p7 5 /an 5 p7 5 /an 5 p7 5 /an 5 p7 5 /an 5 nc nc
section 1 overview rev. 3.00 sep 27, 2006 page 13 of 872 rej09b0325-0300 pin name prom mode pin no. mode 1 mode 2 mode 3 mode 4 mode 5 mode 6 mode 7 eprom flash remarks 84 p7 6 /an 6 / da 0 p7 6 /an 6 / da 0 p7 6 /an 6 / da 0 p7 6 /an 6 / da 0 p7 6 /an 6 / da 0 p7 6 /an 6 / da 0 p7 6 /an 6 / da 0 nc nc 85 p7 7 /an 7 / da 1 p7 7 /an 7 / da 1 p7 7 /an 7 / da 1 p7 7 /an 7 / da 1 p7 7 /an 7 / da 1 p7 7 /an 7 / da 1 p7 7 /an 7 / da 1 nc nc 86 av ss av ss av ss av ss av ss av ss av ss v ss v ss 87 p8 0 / rfsh / irq 0 p8 0 / rfsh / irq 0 p8 0 / rfsh / irq 0 p8 0 / rfsh / irq 0 p8 0 / rfsh / irq 0 p8 0 / rfsh / irq 0 p8 0 / irq 0 ea 16 nc 88 p8 1 / cs 3 / irq 1 p8 1 / cs 3 / irq 1 p8 1 / cs 3 / irq 1 p8 1 / cs 3 / irq 1 p8 1 / cs 3 / irq 1 p8 1 / cs 3 / irq 1 p8 1 / irq 1 pgm nc 89 p8 2 / cs 2 / irq 2 p8 2 / cs 2 / irq 2 p8 2 / cs 2 / irq 2 p8 2 / cs 2 / irq 2 p8 2 / cs 2 / irq 2 p8 2 / cs 2 / irq 2 p8 2 / irq 2 nc v cc 90 p8 3 / cs 1 / irq 3 p8 3 / cs 1 / irq 3 p8 3 / cs 1 / irq 3 p8 3 / cs 1 / irq 3 p8 3 / cs 1 / irq 3 p8 3 / cs 1 / irq 3 p8 3 / irq 3 nc we 91 p8 4 / cs 0 p8 4 / cs 0 p8 4 / cs 0 p8 4 / cs 0 p8 4 / cs 0 p8 4 / cs 0 p8 4 nc nc 92 v ss v ss v ss v ss v ss v ss v ss v ss v ss 93 pa 0 /tp 0 / tend 0 / tclka pa 0 /tp 0 / tend 0 / tclka pa 0 /tp 0 / tend 0 / tclka pa 0 /tp 0 / tend 0 / tclka pa 0 /tp 0 / tend 0 / tclka pa 0 /tp 0 / tend 0 / tclka pa 0 /tp 0 / tend 0 / tclka nc nc 94 pa 1 /tp 1 / tend 1 / tclkb pa 1 /tp 1 / tend 1 / tclkb pa 1 /tp 1 / tend 1 / tclkb pa 1 /tp 1 / tend 1 / tclkb pa 1 /tp 1 / tend 1 / tclkb pa 1 /tp 1 / tend 1 / tclkb pa 1 /tp 1 / tend 1 / tclkb nc nc 95 pa 2 /tp 2 / tioca 0 / tclkc pa 2 /tp 2 / tioca 0 / tclkc pa 2 /tp 2 / tioca 0 / tclkc pa 2 /tp 2 / tioca 0 / tclkc pa 2 /tp 2 / tioca 0 / tclkc pa 2 /tp 2 / tioca 0 / tclkc pa 2 /tp 2 / tioca 0 / tclkc nc nc 96 pa 3 /tp 3 / tiocb 0 / tclkd pa 3 /tp 3 / tiocb 0 / tclkd pa 3 /tp 3 / tiocb 0 / tclkd pa 3 /tp 3 / tiocb 0 / tclkd pa 3 /tp 3 / tiocb 0 / tclkd pa 3 /tp 3 / tiocb 0 / tclkd pa 3 /tp 3 / tiocb 0 / tclkd nc nc 97 pa 4 /tp 4 / tioca 1 / cs 6 pa 4 /tp 4 / tioca 1 / cs 6 pa 4 /tp 4 / tioca 1 / cs 6 pa 4 /tp 4 / tioca 1 / cs 6 pa 4 /tp 4 / tioca 1 / cs 6 pa 4 /tp 4 / tioca 1 / a 23 / cs 6 pa 4 /tp 4 / tioca 1 nc nc 98 pa 5 /tp 5 / tiocb 1 / cs 5 pa 5 /tp 5 / tiocb 1 / cs 5 pa 5 /tp 5 / tiocb 1 / cs 5 pa 5 /tp 5 / tiocb 1 / cs 5 pa 5 /tp 5 / tiocb 1 / cs 5 pa 5 /tp 5 / tiocb 1 / a 22 / cs 5 pa 5 /tp 5 / tiocb 1 nc nc 99 pa 6 /tp 6 / tioca 2 / cs 4 pa 6 /tp 6 / tioca 2 / cs 4 pa 6 /tp 6 / tioca 2 / cs 4 pa 6 /tp 6 / tioca 2 / cs 4 pa 6 /tp 6 / tioca 2 / cs 4 pa 6 /tp 6 / tioca 2 / a 21 / cs 4 pa 6 /tp 6 / tioca 2 nc nc 100 pa 7 /tp 7 / tiocb 2 pa 7 /tp 7 / tiocb 2 a 20 a 20 pa 7 /tp 7 / tiocb 2 a 20 pa 7 /tp 7 / tiocb 2 nc nc
section 1 overview rev. 3.00 sep 27, 2006 page 14 of 872 rej09b0325-0300 notes: pins marked nc should be left unconnected. for details on prom mode see section 18, rom (h8/3048f-one: single power supply, h8/3048b mask rom version). 1. in modes 1, 3, 5, and 6 the p4 0 to p4 7 functions of pins p4 0 /d 0 to p4 7 /d 7 are selected after a reset, but they can be changed by software. 2. in modes 2 and 4 the d 0 to d 7 functions of pins p4 0 /d 0 to p4 7 /d 7 are selected after a reset, but they can be changed by software. 3. for the h8/3048b group which operates at 5 v, this pin is also used as the v cl terminal, and for those at 3 v, v cc terminal. for the h8/3048 ztat version, h8/3048f version, h8/3048 mask rom version, h8/3047 mask rom version, h8/3045 mask rom version, and h8/3044 mask rom version, this pin is also used as the v cc terminal. 4. this pin functions as the fwe pin on the single power supply on-chip flash memory version. under no circumstances should 12 v be applied to the single power supply on- chip flash memory version (h8/3048f-one), or to h8/3048 group or h8/3048b group mask rom products. doing so will destroy the chip. this pin functions as an overview control signal in modes 5, 6, and 7. the pin functions as the reso pin in on-chip mask rom versions, on-chip prom versions, and dual power supply flash memory versions.
section 1 overview rev. 3.00 sep 27, 2006 page 15 of 872 rej09b0325-0300 1.3.3 pin functions table 1.4 summarizes the pin functions. for the h8/3048b group which operates at 5 v, the external capacitor is required for the v cl pin. table 1.4 pin functions type symbol pin no. i/o name and function power v cc 1 * 1 , 35, 68 input power: for connection to the power supply. connect all v cc pins to the system power supply. v ss 11, 22, 44, 57, 65, 92 input ground: for connection to ground (0 v). connect all v ss pins to the 0-v system power supply. internal step- down pin v cl 1 * 2 output the external capacitor must be connected between the v cl and gnd (0 v). do not connect to v cc . 0.1
section 1 overview rev. 3.00 sep 27, 2006 page 16 of 872 rej09b0325-0300 type symbol pin no. i/o name and function operating mode control md 2 to md 0 75 to 73 input mode 2 to mode 0: for setting the operating mode, as follows. inputs at these pins must not be changed during operation. md 2 md 1 md 0 operating mode 000 ? 0 0 1 mode 1 0 1 0 mode 2 0 1 1 mode 3 1 0 0 mode 4 1 0 1 mode 5 1 1 0 mode 6 1 1 1 mode 7 system control res 63 input reset input: when driven low, this pin resets the chip reso ( reso /v pp ) 10 output reset output: for the mask rom version, outputs a reset signal to external devices also used as a power supply for on-board programming of the flash memory version with dual power supply. fwe * 3 10 input write enable signal: write-control signal for writing to flash memory for the flash memory version with single power supply stby 62 input standby: when driven low, this pin forces a transition to hardware standby mode breq 59 input bus request: used by an external bus master to request the bus right back 60 output bus request acknowledge: indicates that the bus has been granted to an external bus master interrupts nmi 64 input nonmaskable interrupt: requests a nonmaskable interrupt irq 5 to irq 0 17, 16, 90 to 87 input interrupt request 5 to 0: maskable interrupt request pins address bus a 23 to a 0 97 to 100, 56 to 45, 43 to 36 output address bus: outputs address signals data bus d 15 to d 0 34 to 23, 21 to 18 input/ output data bus: bidirectional data bus
section 1 overview rev. 3.00 sep 27, 2006 page 17 of 872 rej09b0325-0300 type symbol pin no. i/o name and function bus control cs 7 to cs 0 8, 97 to 99, 88 to 91 output chip select: select signals for areas 7 to 0 as 69 output address strobe: goes low to indicate valid address output on the address bus rd 70 output read: goes low to indicate reading from the external address space hwr 71 output high write: goes low to indicate writing to the external address space; indicates valid data on the upper data bus (d 15 to d 8 ). lwr 72 output low write: goes low to indicate writing to the external address space; indicates valid data on the lower data bus (d 7 to d 0 ). wait 58 input wait: requests insertion of wait states in bus cycles during access to the external address space rfsh 87 output refresh: indicates a refresh cycle refresh controller cs 3 88 output row address strobe ras ras ras ras : row address strobe signal for dram connected to area 3 rd 70 output column address strobe cas cas cas cas : column address strobe signal for dram connected to area 3; used with 2 we dram. write enable we we we we : write enable signal for dram connected to area 3; used with 2 cas dram. hwr 71 output upper write uw uw uw uw : write enable signal for dram connected to area 3; used with 2 we dram. upper column address strobe ucas ucas ucas ucas : column address strobe signal for dram connected to area 3; used with 2 cas dram. lwr 72 output lower write lw lw lw lw : write enable signal for dram connected to area 3; used with 2 we dram. lower column address strobe lcas lcas lcas lcas : column address strobe signal for dram connected to area 3; used with 2 cas dram.
section 1 overview rev. 3.00 sep 27, 2006 page 18 of 872 rej09b0325-0300 type symbol pin no. i/o name and function dreq 1 , dreq 0 9, 8 input dma request 1 and 0: dmac activation requests dma controller (dmac) tend 1 , tend 0 94, 93 output transfer end 1 and 0: these signals indicate that the dmac has ended a data transfer tclkd to tclka 96 to 93 input clock input d to a: external clock inputs 16-bit integrated timer unit (itu) tioca 4 to tioca 0 4, 2, 99, 97, 95 input/ output input capture/output compare a4 to a0: gra4 to gra0 output compare or input capture, or pwm output tiocb 4 to tiocb 0 5, 3, 100, 98, 96 input/ output input capture/output compare b4 to b0: grb4 to grb0 output compare or input capture tocxa 4 6 output output compare xa4: pwm output tocxb 4 7 output output compare xb4: pwm output programmable timing pattern controller (tpc) tp 15 to tp 0 9 to 2, 100 to 93 output tpc output 15 to 0: pulse output txd 1 , txd 0 13, 12 output transmit data (channels 0 and 1): sci data output serial communication interface (sci) rxd 1 , rxd 0 15, 14 input receive data (channels 0 and 1): sci data input sck 1 , sck 0 17, 16 input/ output serial clock (channels 0 and 1): sci clock input/output a/d converter an 7 to an 0 85 to 78 input analog 7 to 0: analog input pins adtrg 9 input a/d trigger: external trigger input for starting a/d conversion d/a converter da 1 , da 0 85, 84 output analog output: analog output from the d/a converter a/d and d/a converters av cc 76 input power supply pin for the a/d and d/a converters. connect to the system power supply (v cc ) when not using the a/d and d/a converters. av ss 86 input ground pin for the a/d and d/a converters. connect to system ground (v ss ).
section 1 overview rev. 3.00 sep 27, 2006 page 19 of 872 rej09b0325-0300 type symbol pin no. i/o name and function a/d and d/a converters v ref 77 input reference voltage input pin for the a/d and d/a converters. connect to the system power supply (v cc ) when not using the a/d and d/a converters. i/o ports p1 7 to p1 0 43 to 36 input/ output port 1: eight input/output pins. the direction of each pin can be selected in the port 1 data direction register (p1ddr). p2 7 to p2 0 52 to 45 input/ output port 2: eight input/output pins. the direction of each pin can be selected in the port 2 data direction register (p2ddr). p3 7 to p3 0 34 to 27 input/ output port 3: eight input/output pins. the direction of each pin can be selected in the port 3 data direction register (p3ddr). p4 7 to p4 0 26 to 23, 21 to 18 input/ output port 4: eight input/output pins. the direction of each pin can be selected in the port 4 data direction register (p4ddr). p5 3 to p5 0 56 to 53 input/ output port 5: four input/output pins. the direction of each pin can be selected in the port 5 data direction register (p5ddr). p6 6 to p6 0 72 to 69, 60 to 58 input/ output port 6: seven input/output pins. the direction of each pin can be selected in the port 6 data direction register (p6ddr). p7 7 to p7 0 85 to 78 input port 7: eight input pins p8 4 to p8 0 91 to 87 input/ output port 8: five input/output pins. the direction of each pin can be selected in the port 8 data direction register (p8ddr). p9 5 to p9 0 17 to 12 input/ output port 9: six input/output pins. the direction of each pin can be selected in the port 9 data direction register (p9ddr). pa 7 to pa 0 100 to 93 input/ output port a: eight input/output pins. the direction of each pin can be selected in the port a data direction register (paddr). pb 7 to pb 0 9 to 2 input/ output port b: eight input/output pins. the direction of each pin can be selected in the port b data direction register (pbddr). notes: 1. for h8/3048 group products and h8/3048b group models operating at 3 v. 2. for the h8/3048b group which operates at 5 v. 3. do not apply 12 v to the h8/3048b group as the chip will be destroyed.
section 1 overview rev. 3.00 sep 27, 2006 page 20 of 872 rej09b0325-0300 1.4 notes on h8/3048f-one (single power supply) there are two models of the h8/3048f-ztat with on-chip flash memory: a dual power supply model (h8/3048f) and single power supply model (h8/3048f-one). points to be noted when using the single power supply h8/3048f-one are given below. 1.4.1 voltage application 12 v must not be applied to the h8/3048f-one (single power supply), as this will permanently damage the device. the flash memory programming power source for the h8/3048f-one (single power supply) is v cc . the programming power source for the dual power supply model was the v pp pin (12 v), but there is no v pp pin in the single power supply models. in the h8/3048f-one the fwe pin is provided at the same pin position as the v pp pin in the dual power supply model, but fwe is not a power source pin-it is used to control flash memory write enabling. also, in boot mode, 12 v must be applied to the md 2 pin in the dual power supply model, but this is not necessary in the h8/3048f-one (single power supply). the maximum rating of the fwe and md 2 pins in the h8/3048f-one (single power supply) is v cc +0.3 v. applying a voltage in excess of the maximum rating will permanently damage the device. do not select the hn28f101 programmer setting for the h8/3048f-one (single power supply). if this setting is made by mistake, 12.0 v may be applied to the fwe pin, causing permanent damage to the device. when using a prom programmer to program the on-chip flash memory in the h8/3048f-one model (single power supply), use a prom programmer that supports renesas technology microcomputer device types with 128-kbyte on-chip flash memory.
section 1 overview rev. 3.00 sep 27, 2006 page 21 of 872 rej09b0325-0300 1.4.2 product type names and markings table 1.5 shows examples of product type names and markings for the h8/3048f (dual power supply model), h8/3048f-one (single power supply), and the differences in flash memory programming power source. table 1.5 differences in h8/3048f and h8/3048f-one dual power supply model: h8/3048f single power supply model: h8/3048f-one product type name HD64F3048F16 hd64f3048bf25 hd64f3048bvf25 sample markings h8/3048 hd 64f3048f16 3j1 h8/3048f-one pgm 5.0 b 0021 bk80090 64f3048f25 h8/3048f-one pgm 3.3 b 0021 bk80090 64f3048vf25 flash memory programming power source v pp power source (12.0 0.6 v) v cc power source (5.0 10%) v cc power source (3.0 to 3.6 v) 1.4.3 differences between h8/3048f and h8/3048f-one table 1.6 shows the differences between the h8/3048f (dual power supply model) and h8/3048f- one (single power supply model).
section 1 overview rev. 3.00 sep 27, 2006 page 22 of 872 rej09b0325-0300 table 1.6 differences between h8/3048f and h8/3048f-one item models with dual power supply: h8/3048f * 1 models with single power supply: h8/3048f-one pin specifications pin 1: v cc pin 1: v cl (when a model which operates at 5 v is used) connected to v ss with 0.1 reso pin 10: fwe rom/ram 128-kbyte flash memory with dual power supply, ram: 4 kbytes 128-kbyte flash memory with single power supply, ram: 4 kbytes units of on- board writing writing in 1-byte units writing in 128-byte units write/erase voltage 12 v is externally applied from v pp pin application of 12 v is not required. v cc single power supply v pp pin functions multiplexes with reso fwe function only (no reso function) boot mode settings cancelled by reset reso = 12 v mode 5 mode 6 mode 7 md2 12 v 12 v 12 v md1 0 1 1 md0 1 0 1 set to mode 1 in mode 5 set to mode 2 in mode 6 set to mode 3 in mode 7 cancelled by reset fwe = 1 mode 5 mode 6 mode 7 md2 0 0 0 md1 0 1 1 md0 1 0 1 settings for user program mode cancelled by reset reso = 12 v mode 5 mode 6 mode 7 md2 1 1 1 md1 0 1 1 md0 1 0 1 cancelled by reset fwe = 1 mode 5 mode 6 mode 7 md2 1 1 1 md1 0 1 1 md0 1 0 1 prewrite processing necessary before erasing not necessary erasing blocks more than one block can be erased at the same time (verifies in block units and erases only the unerased blocks) erases in one block units. more than one block cannot be erased at the same time (the erasing flow is different)
section 1 overview rev. 3.00 sep 27, 2006 page 23 of 872 rej09b0325-0300 item models with dual power supply: h8/3048f * 1 models with single power supply: h8/3048f-one write processing before writing, sets the block with the address to be written to ebr1/ebr2 no setting flmcr v pp v pp eev ? ? ???? ? ?? ??? ? ramcr (h'ff47) ? ? ? ?
section 1 overview rev. 3.00 sep 27, 2006 page 24 of 872 rej09b0325-0300 item models with dual power supply: h8/3048f * 1 models with single power supply: h8/3048f-one division of ram emulation block h'ef10 h'00000 h'1efff h'1f000 h'1f200 h'1f400 h'1f600 h'1f800 h'1fa00 h'1fc00 h'1fe00 h'1ffff h'ff0f h'f000 h'f1ff on-chip ram flash memory h'ef10 h'00000 h'00400 h'00800 h'00c00 h'01000 h'1ffff h'ff0f h'f000 h'f3ff on-chip ram flash memory reset during operation the res signal must be kept low during at least 6 system clock (6
section 1 overview rev. 3.00 sep 27, 2006 page 25 of 872 rej09b0325-0300 item models with dual power supply: h8/3048f * 1 models with single power supply: h8/3048f-one clock oscillator settling time (syscr sts2 to sts0) setting of standby timer select bits 2 to 0 sts2 0 1 sts1 0 1 0 1 sts0 0 1 0 1 0 1 description 8,192 states 16,384 states 32,768 states 65,536 states 131,072 states 1,024 states illegal setting ? ? on-chip emulator (e10t) notes: 1. refer to the ? h8/3048 group, h8/3048f-ztat ? hardware manual ? for information about h8/3048f. 2. h8/3048f and h8/3048f-one can be referred to also on this manual.
section 1 overview rev. 3.00 sep 27, 2006 page 26 of 872 rej09b0325-0300 1.4.4 v cl pin the h8/3048b group 5 v operation models have a v cl (internal step-down) pin, to which a 0.1 f internal voltage stabilization capacitor must be connected. the method of connecting the external capacitor is shown in figure 1.4. do not connect the v cc power supply to the v cl pin. (connect the v cc power supply to other v cc pins as usual.) note that the v cl output pin occupies the same location as a v cc pin in the h8/3048f, h8/3048ztat and on-chip mask rom models (h8/3048, h8/3047, h8/3045, and h8/3044). v cl (pin 1) external capacitor 0.1 figure 1.4 method of connecting h8/3048b group v cl capacitor the 3 v operation models of the h8/3048b group do not have a v cl pin. the 3 v operation models have a v cc power supply pin at the location of the v cl pin in the 5 v operation models. therefore, 3 v operation models do not require connection of an external capacitor, and this pin should be connected to the power supply in the same way as other v cc pins.
section 1 overview rev. 3.00 sep 27, 2006 page 27 of 872 rej09b0325-0300 v cl external capacitor 0.1 figure 1.5 difference between 5 v and 3 v operation models 1.4.5 note on changeover to h8/3048 group mask rom version care is required when changing from the h8/3048f-one with on-chip flash memory to a model with on-chip h8/3048 group mask rom (h8/3048, h8/3047, h8/3045, or h8/3044). an external capacitor must be connected to the v cl pin of the h8/3048f-one (5 v model). this v cl pin occupies the same location as a v cc pin in the on-chip mask rom versions. changeover to a mask rom version must therefore be taken into account when undertaking pattern design, etc., in the board design stage. h8/3048f-one (5 v operation model) v cc power supply v cc pin v cl pin ? figure 1.6 example of board pattern providing for external capacitor
section 1 overview rev. 3.00 sep 27, 2006 page 28 of 872 rej09b0325-0300 1.5 setting oscillation settling wait time when software standby mode is used, after exiting software standby mode a wait period must be provided to allow the clock to stabilize. select the length of time for which the cpu and peripheral functions are to wait by setting bits sts2 to sts0 in the system control register (syscr) and bits div1 and div0 in the division ratio control register (divcr) according to the operating frequency of the chip. for the h8/3048b group, ensure that the oscillation settling wait time is at least 0.1 ms when operating on an external clock. for setting details, see section 20.4.3, selection of waiting time for exit from software standby mode. 1.6 notes on crystal resonator connection the h8/3048b group support an operating frequency of up to 25 mhz. if a crystal resonator with a frequency higher than 20 mhz is connected, attention must be paid to circuit constants such as external load capacitance values. for details see section 19.2.1, connecting a crystal resonator.
section 2 cpu rev. 3.00 sep 27, 2006 page 29 of 872 rej09b0325-0300 section 2 cpu 2.1 overview the h8/300h cpu is a high-speed central processing unit with an internal 32-bit architecture that is upward-compatible with the h8/300 cpu. the h8/300h cpu has sixteen 16-bit general registers, can address a 16-mbyte linear address space, and is ideal for realtime control. 2.1.1 features the h8/300h cpu has the following features. ? upward compatibility with h8/300 cpu can execute h8/300 series object programs ? general-register architecture sixteen 16-bit general registers (also usable as sixteen 8-bit registers or eight 32-bit registers) ? sixty-two basic instructions ? 8/16/32-bit data transfer and arithmetic and logic instructions ? multiply and divide instructions ? powerful bit-manipulation instructions ? eight addressing modes ? register direct [rn] ? register indirect [@ern] ? register indirect with displacement [@(d:16, ern) or @(d:24, ern)] ? register indirect with post-increment or pre-decrement [@ern+ or @?ern] ? absolute address [@aa:8, @aa:16, or @aa:24] ? immediate [#xx:8, #xx:16, or #xx:32] ? program-counter relative [@(d:8, pc) or @(d:16, pc)] ? memory indirect [@@aa:8] ? 16-mbyte linear address space ? high-speed operation ? all frequently-used instructions execute in two to four states ? maximum clock frequency: 25 mhz (h8/3048b group) ? 8/16/32-bit register-register add/subtract: 80 ns @ 25 mhz/125 ns @ 16 mhz ? 8 8-bit register-register multiply: 560 ns @ 25 mhz/875 ns @ 16 mhz ? 16 8-bit register-register divide: 560 ns @ 25 mhz/875 ns @ 16 mhz
section 2 cpu rev. 3.00 sep 27, 2006 page 30 of 872 rej09b0325-0300 ? 16 16-bit register-register multiply: 880 ns @ 25 mhz/1,375 ns @ 16 mhz ? 32 16-bit register-register divide: 880 ns @ 25 mhz/1,375 ns @ 16 mhz ? two cpu operating modes ? normal mode (not available in the h8/3048b group) ? advanced mode ? low-power mode transition to power-down state by sleep instruction 2.1.2 differences from h8/300 cpu in comparison to the h8/300 cpu, the h8/300h has the following enhancements. ? more general registers eight 16-bit registers have been added. ? expanded address space ? advanced mode supports a maximum 16-mbyte address space. ? normal mode supports the same 64-kbyte address space as the h8/300 cpu. (normal mode is not available in the h8/3048b group.) ? enhanced addressing the addressing modes have been enhanced to make effective use of the 16-mbyte address space. ? enhanced instructions ? data transfer, arithmetic, and logic instructions can operate on 32-bit data. ? signed multiply/divide instructions and other instructions have been added.
section 2 cpu rev. 3.00 sep 27, 2006 page 31 of 872 rej09b0325-0300 2.2 cpu operating modes the h8/300h cpu has two operating modes: normal and advanced. normal mode supports a maximum 64-kbyte address space. advanced mode supports up to 16 mbytes. see figure 2.1. the h8/3048b group can be used only in advanced mode. (information from this point on will apply to advanced mode unless otherwise stated.) cpu operating modes normal mode advanced mode maximum 64 kbytes, program and data areas combined maximum 16 mbytes, program and data areas combined figure 2.1 cpu operating modes
section 2 cpu rev. 3.00 sep 27, 2006 page 32 of 872 rej09b0325-0300 2.3 address space the maximum address space of the h8/300h cpu is 16 mbytes. the h8/3048b group has various operating modes (mcu modes), some providing a 1-mbyte address space, the others supporting the full 16 mbytes. figure 2.2 shows the address ranges of the h8/3048b group. for further details see section 3.6, memory map in each operating mode. the 1-mbyte operating modes use 20-bit addressing. the upper 4 bits of effective addresses are ignored. h'00000 h'fffff h'000000 h'ffffff a. 1-mbyte modes b. 16-mbyte modes figure 2.2 memory map
section 2 cpu rev. 3.00 sep 27, 2006 page 33 of 872 rej09b0325-0300 2.4 register configuration 2.4.1 overview the h8/300h cpu has the internal registers shown in figure 2.3. there are two types of registers: general registers and control registers. er0 er1 er2 er3 er4 er5 er6 er7 e0 e1 e2 e3 e4 e5 e6 e7 r0h r1h r2h r3h r4h r5h r6h r7h r0l r1l r2l r3l r4l r5l r6l r7l 0 7 0 7 0 15 (sp) 23 0 pc 7 ccr 6543210 iuihunzvc general registers (ern) control registers (cr) legend: sp: pc: ccr: i: ui: h: u: n: z: v: c: stack pointer program counter condition code register interrupt mask bit user bit or interrupt mask bit half-carry flag user bit negative flag zero flag overflow flag carry flag figure 2.3 cpu internal registers
section 2 cpu rev. 3.00 sep 27, 2006 page 34 of 872 rej09b0325-0300 2.4.2 general registers the h8/300h cpu has eight 32-bit general registers. these general registers are all functionally alike and can be used without distinction between data registers and address registers. when a general register is used as a data register, it can be accessed as a 32-bit, 16-bit, or 8-bit register. when the general registers are used as 32-bit registers or as address registers, they are designated by the letters er (er0 to er7). the er registers divide into 16-bit general registers designated by the letters e (e0 to e7) and r (r0 to r7). these registers are functionally equivalent, providing a maximum sixteen 16-bit registers. the e registers (e0 to e7) are also referred to as extended registers. the r registers divide into 8-bit general registers designated by the letters rh (r0h to r7h) and rl (r0l to r7l). these registers are functionally equivalent, providing a maximum sixteen 8-bit registers. figure 2.4 illustrates the usage of the general registers. the usage of each register can be selected independently.  address registers  32-bit registers  16-bit registers  8-bit registers er registers er0 to er7 e registers (extended registers) e0 to e7 r registers r0 to r7 rh registers r0h to r7h rl registers r0l to r7l figure 2.4 usage of general registers
section 2 cpu rev. 3.00 sep 27, 2006 page 35 of 872 rej09b0325-0300 general register er7 has the function of stack pointer (sp) in addition to its general-register function, and is used implicitly in exception handling and subroutine calls. figure 2.5 shows the stack. free area stack area sp (er7) figure 2.5 stack 2.4.3 control registers the control registers are the 24-bit program counter (pc) and the 8-bit condition code register (ccr). program counter (pc) this 24-bit counter indicates the address of the next instruction the cpu will execute. the length of all cpu instructions is 2 bytes (one word) or a multiple of 2 bytes, so the least significant pc bit is ignored. when an instruction is fetched, the least significant pc bit is regarded as 0. condition code register (ccr) this 8-bit register contains internal cpu status information, including the interrupt mask bit (i) and half-carry (h), negative (n), zero (z), overflow (v), and carry (c) flags. ? bit 7?interrupt mask bit (i): masks interrupts other than nmi when set to 1. nmi is accepted regardless of the i bit setting. the i bit is set to 1 at the start of an exception-handling sequence. ? bit 6?user bit or interrupt mask bit (ui): can be written and read by software using the ldc, stc, andc, orc, and xorc instructions. this bit can also be used as an interrupt mask bit. for details see section 5, interrupt controller. ? bit 5?half-carry flag (h): when the add.b, addx.b, sub.b, subx.b, cmp.b, or neg.b instruction is executed, this flag is set to 1 if there is a carry or borrow at bit 3, and cleared to 0 otherwise. when the add.w, sub.w, cmp.w, or neg.w instruction is
section 2 cpu rev. 3.00 sep 27, 2006 page 36 of 872 rej09b0325-0300 executed, the h flag is set to 1 if there is a carry or borrow at bit 11, and cleared to 0 otherwise. when the add.l, sub.l, cmp.l, or neg.l instruction is executed, the h flag is set to 1 if there is a carry or borrow at bit 27, and cleared to 0 otherwise. ? bit 4?user bit (u): can be written and read by software using the ldc, stc, andc, orc, and xorc instructions. ? bit 3?negative flag (n): indicates the most significant bit (sign bit) of data. ? bit 2?zero flag (z): set to 1 to indicate zero data, and cleared to 0 to indicate non-zero data. ? bit 1?overflow flag (v): set to 1 when an arithmetic overflow occurs, and cleared to 0 at other times. ? bit 0?carry flag (c): set to 1 when a carry occurs, and cleared to 0 otherwise. used by: ? add instructions, to indicate a carry ? subtract instructions, to indicate a borrow ? shift and rotate instructions, to store the value shifted out of the end bit the carry flag is also used as a bit accumulator by bit manipulation instructions. some instructions leave flag bits unchanged. operations can be performed on ccr by the ldc, stc, andc, orc, and xorc instructions. the n, z, v, and c flags are used by conditional branch (bcc) instructions. for the action of each instruction on the flag bits, see appendix a.1, instruction list. for the i and ui bits, see section 5, interrupt controller. 2.4.4 initial cpu register values in reset exception handling, pc is initialized to a value loaded from the vector table, and the i bit in ccr is set to 1. the other ccr bits and the general registers are not initialized. in particular, the stack pointer (er7) is not initialized. the stack pointer must therefore be initialized by an mov.l instruction executed immediately after a reset.
section 2 cpu rev. 3.00 sep 27, 2006 page 37 of 872 rej09b0325-0300 2.5 data formats the h8/300h cpu can process 1-bit, 4-bit (bcd), 8-bit (byte), 16-bit (word), and 32-bit (longword) data. bit-manipulation instructions operate on 1-bit data by accessing bit n (n = 0, 1, 2, ?, 7) of byte operand data. the daa and das decimal-adjust instructions treat byte data as two digits of 4-bit bcd data. 2.5.1 general register data formats figures 2.6 and 2.7 show the data formats in general registers. 7 rnh rnl rnh rnl rnh rnl 1-bit data 1-bit data 4-bit bcd data 4-bit bcd data byte data byte data 6543210 70 don ? t care 76543210 70 don ? t care don ? t care 70 43 lower digit upper digit 7 43 lower digit upper digit don ? t care 0 70 don ? t care msb lsb don ? t care 70 msb lsb data type data format general register figure 2.6 general register data formats (1)
section 2 cpu rev. 3.00 sep 27, 2006 page 38 of 872 rej09b0325-0300 rn en ern word data word data longword data 15 0 msb lsb general register data type data format 15 0 msb lsb 31 16 msb 15 0 lsb legend: ern: en: rn: rnh: rnl: msb: lsb: general register general register e general register r general register rh general register rl most significant bit least significant bit figure 2.7 general register data formats (2)
section 2 cpu rev. 3.00 sep 27, 2006 page 39 of 872 rej09b0325-0300 2.5.2 memory data formats figure 2.8 shows the data formats on memory. the h8/300h cpu can access word data and longword data on memory, but word or longword data must begin at an even address. if an attempt is made to access word or longword data at an odd address, no address error occurs but the least significant bit of the address is regarded as 0, so the access starts at the preceding address. this also applies to instruction fetches. 76543210 address l address l lsb msb msb lsb 70 msb lsb 1-bit data byte data word data longword data address data type data format address 2m address 2m + 1 address 2n address 2n + 1 address 2n + 2 address 2n + 3 figure 2.8 memory data formats when er7 (sp) is used as an address register to access the stack, the operand size should be word size or longword size.
section 2 cpu rev. 3.00 sep 27, 2006 page 40 of 872 rej09b0325-0300 2.6 instruction set 2.6.1 instruction set overview the h8/300h cpu has 62 types of instructions, which are classified in table 2.1. table 2.1 instruction classification function instruction types data transfer mov, push * 1 , pop * 1 , movtpe * 2 , movfpe * 2 3 arithmetic operations add, sub, addx, subx, inc, dec, adds, subs, daa, das, mulxu, mulxs, divxu, divxs, cmp, neg, exts, extu 18 logic operations and, or, xor, not 4 shift operations shal, shar, shll, shlr, rotl, rotr, rotxl, rotxr 8 bit manipulation bset, bclr, bnot, btst, band, biand, bor, bior, bxor, bixor, bld, bild, bst, bist 14 branch bcc * 3 , jmp, bsr, jsr, rts 5 system control trapa, rte, sleep, ldc, stc, andc, orc, xorc, nop 9 block data transfer eepmov 1 total 62 types notes: 1. pop.w rn is identical to mov.w @sp+, rn. push.w rn is identical to mov.w rn, @ ? sp. pop.l ern is identical to mov.l @sp+, rn. push.l ern is identical to mov.l rn, @ ? sp. 2. not available in the h8/3048b group. 3. bcc is a generic branching instruction.
section 2 cpu rev. 3.00 sep 27, 2006 page 41 of 872 rej09b0325-0300 2.6.2 instructions and addressing modes table 2.2 indicates the instructions available in the h8/300h cpu. table 2.2 instructions and addressing modes addressing modes function instruction #xx rn @ern @(d:16,ern) @(d:24,ern) @ern+/@?ern @aa:8 @aa:16 @aa:24 @(d:8,pc) @(d:16,pc) @@aa:8 ? mov bwl bwl bwl bwl bwl bwl b bwl bwl ???? data transfer pop, push ???????????? wl movfpe * , movtpe * ??????? b ????? add, cmp bwl bwl ??????????? arithmetic operations sub wl bwl ??????????? addx, subx b b ??????????? adds, subs ? l ??????????? inc, dec ? bwl ??????????? daa, das ? b ??????????? mulxu, mulxs, divxu, divxs ? bw ??????????? neg ? bwl ??????????? extu, exts ? wl ??????????? and, or, xor bwl bwl ??????????? logic operations not ? bwl ??????????? shift instructions ? bwl ??????????? bit manipulation ? bb ??? b ?????? branch bcc, bsr ????????? ?? jmp, jsr ?? ????? ?? ? rts ???????????? trapa ???????????? system control rte ???????????? sleep ???????????? ldc b b wwww ? ww ???? stc ? b wwww ? ww ???? andc, orc, xorc b ???????????? nop ???????????? block data transfer ???????????? bw legend: b: byte w: word l: longword note: * not availabe in the h8/3048b group.
section 2 cpu rev. 3.00 sep 27, 2006 page 42 of 872 rej09b0325-0300 2.6.3 tables of instructions classified by function tables 2.3 to 2.10 summarize the instructions in each functional category. the operation notation used in these tables is defined next. operation notation rd general register (destination) * rs general register (source) * rn general register * ern general register (32-bit register or address register) (ead) destination operand (eas) source operand ccr condition code register n n (negative) flag of ccr z z (zero) flag of ccr v v (overflow) flag of ccr c c (carry) flag of ccr pc program counter sp stack pointer #imm immediate data disp displacement + addition ? subtraction ? not (logical complement) :3/:8/:16/:24 3-, 8-, 16-, or 24-bit length note: * general registers include 8-bit registers (r0h to r7h, r0l to r7l), 16-bit registers (r0 to r7, e0 to e7), and 32-bit data or address registers (er0 to er7).
section 2 cpu rev. 3.00 sep 27, 2006 page 43 of 872 rej09b0325-0300 table 2.3 data transfer instructions instruction size * function mov b/w/l (eas) ? sp pushes a general register onto the stack. push.w rn is identical to mov.w rn, @ ? sp. similarly, push.l ern is identical to mov.l ern, @ ? sp. note: * size refers to the operand size. b: byte w: word l: longword
section 2 cpu rev. 3.00 sep 27, 2006 page 44 of 872 rej09b0325-0300 table 2.4 arithmetic operation instructions instruction size * function add, sub b/w/l rd rs rs 8 bits 16 bits rs 8 bits 16 bits
section 2 cpu rev. 3.00 sep 27, 2006 page 45 of 872 rej09b0325-0300 instruction size * function cmp b/w/l rd ? rs, rd ? #imm compares data in a general register with data in another general register or with immediate data, and sets ccr according to the result. neg b/w/l 0 ? rd ? s complement (arithmetic complement) of data in a general register. exts w/l rd (sign extension) * size refers to the operand size. b: byte w: word l: longword
section 2 cpu rev. 3.00 sep 27, 2006 page 46 of 872 rej09b0325-0300 table 2.5 logic operation instructions instruction size * function and b/w/l rd ? rd ? s complement of general register contents. note: * size refers to the operand size. b: byte w: word l: longword table 2.6 shift instructions instruction size * function shal, shar b/w/l rd (shift) * size refers to the operand size. b: byte w: word l: longword
section 2 cpu rev. 3.00 sep 27, 2006 page 47 of 872 rej09b0325-0300 table 2.7 bit manipulation instructions instruction size * function bset b 1 ? ( of ) ? ( of ) ? ( of )] ? ( of )]
section 2 cpu rev. 3.00 sep 27, 2006 page 48 of 872 rej09b0325-0300 instruction size * function bxor b c ? ( of )] ? ( of ) ? ( of ) transfers the inverse of the carry flag value to a specified bit in a general register or memory operand. the bit number is specified by 3-bit immediate data. note: * size refers to the operand size. b: byte
section 2 cpu rev. 3.00 sep 27, 2006 page 49 of 872 rej09b0325-0300 table 2.8 branching instructions instruction size function bcc ? branches to a specified address if a specified condition is true. the branching conditions are listed below. mnemonic description condition bra (bt) always (true) always brn (bf) never (false) never bhi high c ? branches unconditionally to a specified address bsr ? branches to a subroutine at a specified address jsr ? branches to a subroutine at a specified address rts ? returns from a subroutine
section 2 cpu rev. 3.00 sep 27, 2006 page 50 of 872 rej09b0325-0300 table 2.9 system control instructions instruction size * function trapa ? starts trap-instruction exception handling rte ? returns from an exception-handling routine sleep ? causes a transition to the power-down state ldc b/w (eas) ? pc + 2 * size refers to the operand size. b: byte w: word
section 2 cpu rev. 3.00 sep 27, 2006 page 51 of 872 rej09b0325-0300 table 2.10 block transfer instruction instruction size function eepmov.b ? if r4l ? 1 ? if r4 ? 1
section 2 cpu rev. 3.00 sep 27, 2006 page 52 of 872 rej09b0325-0300 2.6.4 basic instruction formats the h8/300h instructions consist of 2-byte (1-word) units. an instruction consists of an operation field (op field), a register field (r field), an effective address extension (ea field), and a condition field (cc). operation field: indicates the function of the instruction, the addressing mode, and the operation to be carried out on the operand. the operation field always includes the first 4 bits of the instruction. some instructions have two operation fields. register field: specifies a general register. address registers are specified by 3 bits, data registers by 3 bits or 4 bits. some instructions have two register fields. some have no register field. effective address extension: eight, 16, or 32 bits specifying immediate data, an absolute address, or a displacement. a 24-bit address or displacement is treated as 32-bit data in which the first 8 bits are 0 (h'00). condition field: specifies the branching condition of bcc instructions. figure 2.9 shows examples of instruction formats. op nop, rts, etc. op rn rm op rn rm ea (disp) operation field only add.b rn, rm, etc. operation field and register fields mov.b @(d:16, rn), rm operation field, register fields, and effective address extension bra d:8 operation field, effective address extension, and condition field op cc ea (disp) figure 2.9 instruction formats
section 2 cpu rev. 3.00 sep 27, 2006 page 53 of 872 rej09b0325-0300 2.6.5 notes on use of bit manipulation instructions the bset, bclr, bnot, bst, and bist instructions read a byte of data, modify a bit in the byte, then write the byte back. care is required when these instructions are used to access registers with write-only bits, or to access ports. the bclr instruction can be used to clear flags in the internal i/o registers. in an interrupt- handling routine, for example, if it is known that the flag is set to 1, it is not necessary to read the flag ahead of time. step description 1 read read data (byte unit) at the specified address 2 bit manipulation modify the specified bit in the read data 3 write write the modified data (byte unit) to the specified address in the following example, a bclr instruction is executed on the data direction register (ddr) of port 4. p4 7 and p4 6 are set as input pins, and are inputting low-level and high-level signals, respectively. p4 5 to p4 0 are set as output pins, and are in the low-level output state. in this example, the bclr instruction is used to make p4 0 an input port. before execution of bclr instruction p4 7 p4 6 p4 5 p4 4 p4 3 p4 2 p4 1 p4 0 input/output input input output output output output output output ddr 00111111 dr 10000000 execution of bclr instruction bclr #0, @ p4ddr ; execute bclr instruction on ddr
section 2 cpu rev. 3.00 sep 27, 2006 page 54 of 872 rej09b0325-0300 after execution of bclr instruction p4 7 p4 6 p4 5 p4 4 p4 3 p4 2 p4 1 p4 0 input/output output output output output output output output input ddr 1 111111 0 dr 10000000 explanation of bclr instruction to execute the bclr instruction, the cpu begins by reading p4ddr. since p4ddr is a write- only register, it is read as h'ff, even though its true value is h'3f. next the cpu clears bit 0 of the read data, changing the value to h'fe. finally, the cpu writes this value (h'fe) back to ddr to complete the bclr instruction. as a result, p4 0 ddr is cleared to 0, making p4 0 an input pin. in addition, p4 7 ddr and p4 6 ddr are set to 1, making p4 7 and p4 6 output pins. the bclr instruction can be used to clear flags in the internal i/o registers to 0. in an interrupt- handling routine, for example, if it is known that the flag is set to 1, it is not necessary to read the flag ahead of time. 2.7 addressing modes and effective address calculation 2.7.1 addressing modes the h8/300h cpu supports the eight addressing modes listed in table 2.11. each instruction uses a subset of these addressing modes. arithmetic and logic instructions can use the register direct and immediate modes. data transfer instructions can use all addressing modes except program- counter relative and memory indirect. bit manipulation instructions use register direct, register indirect, or absolute (@aa:8) addressing mode to specify an operand, and register direct (bset, bclr, bnot, and btst instructions) or immediate (3-bit) addressing mode to specify a bit number in the operand.
section 2 cpu rev. 3.00 sep 27, 2006 page 55 of 872 rej09b0325-0300 table 2.11 addressing modes no. addressing mode symbol 1 register direct rn 2 register indirect @ern 3 register indirect with displacement @(d:16, ern)/@(d:24, ern) 4 register indirect with post-increment register indirect with pre-decrement @ern+ @ ? ern 5 absolute address @aa:8/@aa:16/@aa:24 6 immediate #xx:8/#xx:16/#xx:32 7 program-counter relative @(d:8, pc)/@(d:16, pc) 8 memory indirect @@aa:8 1. register direct?rn the register field of the instruction code specifies an 8-, 16-, or 32-bit register containing the operand. r0h to r7h and r0l to r7l can be specified as 8-bit registers. r0 to r7 and e0 to e7 can be specified as 16-bit registers. er0 to er7 can be specified as 32-bit registers. 2. register indirect?@ern the register field of the instruction code specifies an address register (ern), the lower 24 bits of which contain the address of the operand. 3. register indirect with displacement?@(d:16, ern) or @(d:24, ern) a 16-bit or 24-bit displacement contained in the instruction code is added to the contents of an address register (ern) specified by the register field of the instruction, and the lower 24 bits of the sum specify the address of a memory operand. a 16-bit displacement is sign-extended when added.
section 2 cpu rev. 3.00 sep 27, 2006 page 56 of 872 rej09b0325-0300 4. register indirect with post-increment or pre-decrement?@ern+ or @?ern ? register indirect with post-increment?@ern+ the register field of the instruction code specifies an address register (ern) the lower 24 bits of which contain the address of a memory operand. after the operand is accessed, 1, 2, or 4 is added to the address register contents (32 bits) and the sum is stored in the address register. the value added is 1 for byte access, 2 for word access, or 4 for longword access. for word or longword access, the register value should be even. ? register indirect with pre-decrement?@?ern the value 1, 2, or 4 is subtracted from an address register (ern) specified by the register field in the instruction code, and the lower 24 bits of the result become the address of a memory operand. the result is also stored in the address register. the value subtracted is 1 for byte access, 2 for word access, or 4 for longword access. for word or longword access, the resulting register value should be even. 5. absolute address?@aa:8, @aa:16, or @aa:24 the instruction code contains the absolute address of a memory operand. the absolute address may be 8 bits long (@aa:8), 16 bits long (@aa:16), or 24 bits long (@aa:24). for an 8-bit absolute address, the upper 16 bits are all assumed to be 1 (h'ffff). for a 16-bit absolute address the upper 8 bits are a sign extension. a 24-bit absolute address can access the entire address space. table 2.12 indicates the accessible address ranges. table 2.12 absolute address access ranges absolute address 1-mbyte modes 16-mbyte modes 8 bits (@aa:8) h'fff00 to h'fffff (1048320 to 1048575) h'ffff00 to h'ffffff (16776960 to 16777215) 16 bits (@aa:16) h'00000 to h'07fff, h'f8000 to h'fffff (0 to 32767, 1015808 to 1048575) h'000000 to h'007fff, h'ff8000 to h'ffffff (0 to 32767, 16744448 to 16777215) 24 bits (@aa:24) h'00000 to h'fffff (0 to 1048575) h'000000 to h'ffffff (0 to 16777215)
section 2 cpu rev. 3.00 sep 27, 2006 page 57 of 872 rej09b0325-0300 6. immediate?#xx:8, #xx:16, or #xx:32 the instruction code contains 8-bit (#xx:8), 16-bit (#xx:16), or 32-bit (#xx:32) immediate data as an operand. the instruction codes of the adds, subs, inc, and dec instructions contain immediate data implicitly. the instruction codes of some bit manipulation instructions contain 3-bit immediate data specifying a bit number. the trapa instruction code contains 2-bit immediate data specifying a vector address. 7. program-counter relative?@(d:8, pc) or @(d:16, pc) this mode is used in the bcc and bsr instructions. an 8-bit or 16-bit displacement contained in the instruction code is sign-extended to 24 bits and added to the 24-bit pc contents to generate a 24-bit branch address. the pc value to which the displacement is added is the address of the first byte of the next instruction, so the possible branching range is ?126 to +128 bytes (?63 to +64 words) or ?32766 to +32768 bytes (?16383 to +16384 words) from the branch instruction. the resulting value should be an even number. 8. memory indirect?@@aa:8 this mode can be used by the jmp and jsr instructions. the instruction code contains an 8-bit absolute address specifying a memory operand. this memory operand contains a branch address. the memory operand is accessed by longword access. the first byte of the memory operand is ignored, generating a 24-bit branch address. see figure 2.10. the upper bits of the 8-bit absolute address are assumed to be 0 (h'0000), so the address range is 0 to 255 (h'000000 to h'0000ff). note that the first part of this range is also the exception vector area. for further details see section 5, interrupt controller. specified by @aa:8 reserved branch address figure 2.10 memory-indirect branch address specification
section 2 cpu rev. 3.00 sep 27, 2006 page 58 of 872 rej09b0325-0300 when a word-size or longword-size memory operand is specified, or when a branch address is specified, if the specified memory address is odd, the least significant bit is regarded as 0. the accessed data or instruction code therefore begins at the preceding address. see section 2.5.2, memory data formats. 2.7.2 effective address calculation table 2.13 explains how an effective address is calculated in each addressing mode. in the 1-mbyte operating modes the upper 4 bits of the calculated address are ignored in order to generate a 20-bit effective address.
section 2 cpu rev. 3.00 sep 27, 2006 page 59 of 872 rej09b0325-0300 table 2.13 effective address calculation no. addressing mode and instruction format effective address calculation effective address 1 register direct (rn) op rm rn operand is general register contents 2 register indirect (@ern) general register contents 31 0 0 r op 23 3 register indirect with displacement @(d:16, ern)/@(d:24, ern) general register contents sign extension disp 31 0 23 0 op r disp 4. register indirect with post-increment or pre-decrement ? register indirect with post-increment @ern+ general register contents 1, 2, or 4 31 0 0 r op 23 ? register indirect with pre-decrement @ ? ern general register contents 1 for a byte operand, 2 for a word operand, 4 for a longword operand 1, 2, or 4 31 0 23 0 op r
section 2 cpu rev. 3.00 sep 27, 2006 page 60 of 872 rej09b0325-0300 no. addressing mode and instruction format effective address calculation effective address 5 absolute address @aa:8 @aa:16 @aa:24 0 8 7 0 16 15 0 op abs op abs op abs h'ffff 23 23 23 sign exten- sion 6 immediate #xx:8, #xx:16, or #xx:32 op imm operand is immediate data 7 program-counter relative @(d:8, pc) or @(d:16, pc) 0 23 disp 0 23 op disp pc contents sign exten- sion
section 2 cpu rev. 3.00 sep 27, 2006 page 61 of 872 rej09b0325-0300 no. addressing mode and instruction format effective address calculation effective address 8 memory indirect @@aa:8 ? normal mode 0 0 23 8 7 h'0000 0 op abs abs 16 15 15 memory contents 23 h'00 ? advanced mode 0 0 23 8 7 0 31 h'0000 0 op abs abs memory contents 23 legend: r, rm, rn: register field op: operation field disp: displacement imm: immediate data abs: absolute address
section 2 cpu rev. 3.00 sep 27, 2006 page 62 of 872 rej09b0325-0300 2.8 processing states 2.8.1 overview the h8/300h cpu has five processing states: the program execution state, exception-handling state, power-down state, reset state, and bus-released state. the power-down state includes sleep mode, software standby mode, and hardware standby mode. figure 2.11 classifies the processing states. figure 2.13 indicates the state transitions. processing states program execution state bus-released state reset state power-down state the cpu executes program instructions in sequence a transient state in which the cpu executes a hardware sequence (saving pc and ccr, fetching a vector, etc.) in response to a reset, interrupt, or other exception the external bus has been released in response to a bus request signal from a bus master other than the cpu the cpu and all on-chip supporting modules are initialized and halted the cpu is halted to conserve power sleep mode software standby mode hardware standby mode exception-handling state figure 2.11 processing states 2.8.2 program execution state in this state the cpu executes program instructions in normal sequence.
section 2 cpu rev. 3.00 sep 27, 2006 page 63 of 872 rej09b0325-0300 2.8.3 exception-handling state the exception-handling state is a transient state that occurs when the cpu alters the normal program flow due to a reset, interrupt, or trap instruction. the cpu fetches a starting address from the exception vector table and branches to that address. in interrupt and trap exception handling the cpu references the stack pointer (er7) and saves the program counter and condition code register. types of exception handling and their priority: exception handling is performed for resets, interrupts, and trap instructions. table 2.14 indicates the types of exception handling and their priority. trap instruction exceptions are accepted at all times in the program execution state. table 2.14 exception handling types and priority priority type of exception detection timing start of exception handling high reset synchronized with clock exception handling starts immediately when res changes from low to high interrupt end of instruction execution or end of exception handling * when an interrupt is requested, exception handling starts at the end of the current instruction or current exception-handling sequence low trap instruction when trapa instruction is executed exception handling starts when a trap (trapa) instruction is executed note: * interrupts are not detected at the end of the andc, orc, xorc, and ldc instructions, or immediately after reset exception handling. figure 2.12 classifies the exception sources. for further details about exception sources, vector numbers, and vector addresses, see section 4, exception handling, and section 5, interrupt controller. exception sources reset interrupt trap instruction external interrupts internal interrupts (from on-chip supporting modules) figure 2.12 classification of exception sources
section 2 cpu rev. 3.00 sep 27, 2006 page 64 of 872 rej09b0325-0300 bus-released state exception-handling state reset state * 1 program execution state sleep mode software standby mode hardware standby mode * 2 power-down state end of bus release bus request end of bus release bus request end of exception handling exception interrupt sleep instruction with ssby = 0 sleep instruction with ssby = 1 nmi, irq , irq , or irq interrupt stby = high, res = low res = high 01 2 notes: 1. 2. from any state except hardware standby mode, a transition to the reset state occurs whenever res goes low. from any state, a transition to hardware standby mode occurs when stby goes low. figure 2.13 state transitions 2.8.4 exception-handling sequences reset exception handling: reset exception handling has the highest priority. the reset state is entered when the res signal goes low. reset exception handling starts after that, when res changes from low to high. when reset exception handling starts the cpu fetches a start address from the exception vector table and starts program execution from that address. all interrupts, including nmi, are disabled during the reset exception-handling sequence and immediately after it ends. interrupt exception handling and trap instruction exception handling: when these exception-handling sequences begin, the cpu references the stack pointer (er7) and pushes the program counter and condition code register on the stack. next, if the ue bit in the system control register (syscr) is set to 1, the cpu sets the i bit in the condition code register to 1. if the ue bit
section 2 cpu rev. 3.00 sep 27, 2006 page 65 of 872 rej09b0325-0300 is cleared to 0, the cpu sets both the i bit and the ui bit in the condition code register to 1. then the cpu fetches a start address from the exception vector table and execution branches to that address. figure 2.14 shows the stack after the exception-handling sequence. sp ? ? ? ? figure 2.14 stack structure after exception handling 2.8.5 bus-released state in this state the bus is released to a bus master other than the cpu, in response to a bus request. the bus masters other than the cpu are the dma controller, the refresh controller, and an external bus master. while the bus is released, the cpu halts except for internal operations. interrupt requests are not accepted. for details see section 6.3.7, bus arbiter operation.
section 2 cpu rev. 3.00 sep 27, 2006 page 66 of 872 rej09b0325-0300 2.8.6 reset state when the res input goes low all current processing stops and the cpu enters the reset state. the i bit in the condition code register is set to 1 by a reset. all interrupts are masked in the reset state. reset exception handling starts when the res signal changes from low to high. the reset state can also be entered by a watchdog timer overflow. for details see section 12, watchdog timer. 2.8.7 power-down state in the power-down state the cpu stops operating to conserve power. there are three modes: sleep mode, software standby mode, and hardware standby mode. sleep mode: a transition to sleep mode is made if the sleep instruction is executed while the ssby bit is cleared to 0 in the system control register (syscr). cpu operations stop immediately after execution of the sleep instruction, but the contents of cpu registers are retained. software standby mode: a transition to software standby mode is made if the sleep instruction is executed while the ssby bit is set to 1 in syscr. the cpu and clock halt and all on-chip supporting modules stop operating. the on-chip supporting modules are reset, but as long as a specified voltage is supplied the contents of cpu registers and on-chip ram are retained. the i/o ports also remain in their existing states. hardware standby mode: a transition to hardware standby mode is made when the stby input goes low. as in software standby mode, the cpu and all clocks halt and the on-chip supporting modules are reset, but as long as a specified voltage is supplied, on-chip ram contents are retained. for further information see section 20, power-down state.
section 2 cpu rev. 3.00 sep 27, 2006 page 67 of 872 rej09b0325-0300 2.9 basic operational timing 2.9.1 overview the h8/300h cpu operates according to the system clock ( ? state. ? a memory cycle or bus cycle consists of two or three states. the cpu uses different methods to access on-chip memory, the on-chip supporting modules, and the external address space. access to the external address space can be controlled by the bus controller. 2.9.2 on-chip memory access timing on-chip memory is accessed in two states. the data bus is 16 bits wide, permitting both byte and word access. figure 2.15 shows the on-chip memory access cycle. figure 2.16 indicates the pin states. t state bus cycle internal address bus internal read signal internal data bus (read access) internal write signal internal data bus (write access) figure 2.15 on-chip memory access cycle
section 2 cpu rev. 3.00 sep 27, 2006 page 68 of 872 rej09b0325-0300 t , , , as rd hwr lwr high address high-impedance figure 2.16 pin states during on-chip memory access 2.9.3 on-chip supporting module access timing the on-chip supporting modules are accessed in three states. the data bus is 8 or 16 bits wide, depending on the register being accessed. figure 2.17 shows the on-chip supporting module access timing. figure 2.18 indicates the pin states. address bus internal read signal internal data bus internal write signal address internal data bus figure 2.17 access cycle for on-chip supporting modules
section 2 cpu rev. 3.00 sep 27, 2006 page 69 of 872 rej09b0325-0300 t , , , as rd hwr lwr high high-impedance t 3 address figure 2.18 pin states during access to on-chip supporting modules 2.9.4 access to external address space the external address space is divided into eight areas (areas 0 to 7). bus-controller settings determine whether each area is accessed via an 8-bit or 16-bit bus, and whether it is accessed in two or three states. for details see section 6, bus controller.
section 2 cpu rev. 3.00 sep 27, 2006 page 70 of 872 rej09b0325-0300
section 3 mcu operating modes rev. 3.00 sep 27, 2006 page 71 of 872 rej09b0325-0300 section 3 mcu operating modes 3.1 overview 3.1.1 operating mode selection the h8/3048b group has seven operating modes (modes 1 to 7) that are selected by the mode pins (md 2 to md 0 ) as indicated in table 3.1. the input at these pins determines the size of the address space and the initial bus mode. table 3.1 operating mode selection mode pins description operating mode md 2 md 1 md 0 address space initial bus mode * 1 on-chip rom on-chip ram ?000? ??? mode 1 0 0 1 expanded mode 8 bits disabled enabled * 2 mode 2 0 1 0 expanded mode 16 bits disabled enabled * 2 mode 3 0 1 1 expanded mode 8 bits disabled enabled * 2 mode 4 1 0 0 expanded mode 16 bits disabled enabled * 2 mode 5 1 0 1 expanded mode 8 bits enabled enabled * 2 mode 6 1 1 0 expanded mode 8 bits enabled enabled * 2 mode 7 1 1 1 single-chip advanced mode ? enabled enabled notes: 1. in modes 1 to 6, an 8-bit or 16-bit data bus can be selected on a per-area basis by settings made in the area bus width control register (abwcr). for details see section 6, bus controller. 2. if the rame bit in syscr is cleared to 0, these addresses become external addresses. for the address space size there are two choices: 1 mbyte or 16 mbytes. the external data bus is either 8 or 16 bits wide depending on abwcr settings. if 8-bit access is selected for all areas, the external data bus is 8 bits wide. for details see section 6, bus controller. modes 1 to 4 are externally expanded modes that enable access to external memory and peripheral devices and disable access to the on-chip rom. modes 1 and 2 support a maximum address space of 1 mbyte. modes 3 and 4 support a maximum address space of 16 mbytes.
section 3 mcu operating modes rev. 3.00 sep 27, 2006 page 72 of 872 rej09b0325-0300 modes 5 and 6 are externally expanded modes that enable access to external memory and peripheral devices and also enable access to the on-chip rom. mode 5 supports a maximum address space of 1 mbyte. mode 6 supports a maximum address space of 16 mbytes. mode 7 is a single-chip mode that operates using the on-chip rom, ram, and internal i/o registers, and makes all i/o ports available. mode 7 supports a 1-mbyte address space. the h8/3048b group can be used only in modes 1 to 7. the inputs at the mode pins must select one of these seven modes. the inputs at the mode pins must not be changed during operation. 3.1.2 register configuration the h8/3048b group has a mode control register (mdcr) that indicates the inputs at the mode pins (md 2 to md 0 ), and a system control register (syscr). table 3.2 summarizes these registers. table 3.2 registers address * name abbreviation r/w initial value h'fff1 mode control register mdcr r undetermined h'fff2 system control register syscr r/w h'0b note: * the lower 16 bits of the address are indicated. 3.2 mode control register (mdcr) mdcr is an 8-bit read-only register that indicates the current operating mode of the h8/3048b group. bit initial value read/write 7 ? ? ? ? ? ? ? ? ? ? ? * 2 mds2 ? ? ** reserved bits mode select 2 to 0 bits indicating the current operating mode reserved bits note: determined by pins md to md . * 2 0
section 3 mcu operating modes rev. 3.00 sep 27, 2006 page 73 of 872 rej09b0325-0300 bits 7 and 6?reserved: read-only bits, always read as 1. bits 5 to 3?reserved: read-only bits, always read as 0. bits 2 to 0?mode select 2 to 0 (mds2 to mds0): these bits indicate the logic levels at pins md 2 to md 0 (the current operating mode). mds2 to mds0 correspond to md 2 to md 0 . mds2 to mds0 are read-only bits. the mode pin (md 2 to md 0 ) levels are latched into these bits when mdcr is read. note: for the flash memory version with single power supply (h8/3048f-one), flash memory can be written to in the boot mode. in the boot mode, the inverted value of the md2 signal is set to bit mds2. 3.3 system control register (syscr) syscr is an 8-bit register that controls the operation of the h8/3048b group. bit initial value read/write 7 ssby 0 r/w 6 sts2 0 r/w 5 sts1 0 r/w 4 sts0 0 r/w 3 ue 1 r/w 0 rame 1 r/w 2 nmieg 0 r/w 1 ? ? software standby enables transition to software standby mode user bit enable selects whether to use the ui bit in ccr as a user bit or an interrupt mask bit nmi edge select selects the valid edge of the nmi input reserved bit ram enable enables or disables on-chip ram standby timer select 2 to 0 these bits select the waiting time at recovery from software standby mode
section 3 mcu operating modes rev. 3.00 sep 27, 2006 page 74 of 872 rej09b0325-0300 bit 7?software standby (ssby): enables transition to software standby mode. (for further information about software standby mode see section 20, power-down state.) when software standby mode is exited by an external interrupt, this bit remains set to 1. to clear this bit, write 0. bit 7: ssby description 0 sleep instruction causes transition to sleep mode (initial value) 1 sleep instruction causes transition to software standby mode bits 6 to 4?standby timer select (sts2 to sts0): these bits select the length of time the cpu and on-chip supporting modules wait for the internal clock oscillator to settle when software standby mode is exited by an external interrupt. when using a crystal oscillator, set these bits so that the waiting time will be at least 7 ms at the system clock rate. for further information about waiting time selection, see section 20.4.3, selection of waiting time for exit from software standby mode. bit 6: sts2 bit 5: sts1 bit 4: sts0 description 0 0 0 waiting time = 8,192 states (initial value) 1 waiting time = 16,384 states 1 0 waiting time = 32,768 states 1 waiting time = 65,536 states 1 0 0 waiting time = 131,072 states 1 waiting time = 262,144 states 1 0 waiting time = 1,024 states 1 illegal setting bit 3?user bit enable (ue): selects whether to use the ui bit in the condition code register as a user bit or an interrupt mask bit. bit 3: ue description 0 ui bit in ccr is used as an interrupt mask bit 1 ui bit in ccr is used as a user bit (initial value)
section 3 mcu operating modes rev. 3.00 sep 27, 2006 page 75 of 872 rej09b0325-0300 bit 2?nmi edge select (nmieg): selects the valid edge of the nmi input. bit 2: nmieg description 0 an interrupt is requested at the falling edge of nmi (initial value) 1 an interrupt is requested at the rising edge of nmi bit 1?reserved: read-only bit, always read as 1. bit 0?ram enable (rame): enables or disables the on-chip ram. the rame bit is initialized by the rising edge of the res signal. it is not initialized in software standby mode. bit 0: rame description 0 on-chip ram is disabled 1 on-chip ram is enabled (initial value) 3.4 operating mode descriptions 3.4.1 mode 1 ports 1, 2, and 5 function as address pins a 19 to a 0 , permitting access to a maximum 1-mbyte address space. the initial bus mode after a reset is 8 bits, with 8-bit access to all areas. if at least one area is designated for 16-bit access in abwcr, the bus mode switches to 16 bits. 3.4.2 mode 2 ports 1, 2, and 5 function as address pins a 19 to a 0 , permitting access to a maximum 1-mbyte address space. the initial bus mode after a reset is 16 bits, with 16-bit access to all areas. if all areas are designated for 8-bit access in abwcr, the bus mode switches to 8 bits. 3.4.3 mode 3 ports 1, 2, and 5 and part of port a function as address pins a 23 to a 0 , permitting access to a maximum 16-mbyte address space. the initial bus mode after a reset is 8 bits, with 8-bit access to all areas. if at least one area is designated for 16-bit access in abwcr, the bus mode switches to 16 bits. a 23 to a 21 are valid when 0 is written in bits 7 to 5 of the bus release control register (brcr). (in this mode a 20 is always used for address output.)
section 3 mcu operating modes rev. 3.00 sep 27, 2006 page 76 of 872 rej09b0325-0300 3.4.4 mode 4 ports 1, 2, and 5 and part of port a function as address pins a 23 to a 0 , permitting access to a maximum 16-mbyte address space. the initial bus mode after a reset is 16 bits, with 16-bit access to all areas. if all areas are designated for 8-bit access in abwcr, the bus mode switches to 8 bits. a 23 to a 21 are valid when 0 is written in bits 7 to 5 of brcr. (in this mode a 20 is always used for address output.) 3.4.5 mode 5 ports 1, 2, and 5 can function as address pins a 19 to a 0 , permitting access to a maximum 1-mbyte address space, but following a reset they are input ports. to use ports 1, 2, and 5 as an address bus, the corresponding bits in their data direction registers (p1ddr, p2ddr, and p5ddr) must be set to 1. the initial bus mode after a reset is 8 bits, with 8-bit access to all areas. if at least one area is designated for 16-bit access in abwcr, the bus mode switches to 16 bits. 3.4.6 mode 6 ports 1, 2, and 5 and part of port a function as address pins a 23 to a 0 , permitting access to a maximum 16-mbyte address space, but following a reset they are input ports. to use ports 1, 2, and 5 as an address bus, the corresponding bits in their data direction registers (p1ddr, p2ddr, and p5ddr) must be set to 1. for a 23 to a 21 output, clear bits 7 to 5 of brcr to 0. (in this mode a 20 is always used for address output.) the initial bus mode after a reset is 8 bits, with 8-bit access to all areas. if at least one area is designated for 16-bit access in abwcr, the bus mode switches to 16 bits. 3.4.7 mode 7 this mode operates using the on-chip rom, ram, and internal i/o registers. all i/o ports are available. mode 7 supports a 1-mbyte address space.
section 3 mcu operating modes rev. 3.00 sep 27, 2006 page 77 of 872 rej09b0325-0300 3.5 pin functions in each operating mode the pin functions of ports 1 to 5 and port a vary depending on the operating mode. table 3.3 indicates their functions in each operating mode. table 3.3 pin functions in each mode port mode 1 mode 2 mode 3 mode 4 mode 5 mode 6 mode 7 port 1 a 7 to a 0 a 7 to a 0 a 7 to a 0 a 7 to a 0 p1 7 to p1 0 * 2 p1 7 to p1 0 * 2 p1 7 to p1 0 port 2 a 15 to a 8 a 15 to a 8 a 15 to a 8 a 15 to a 8 p2 7 to p2 0 * 2 p2 7 to p2 0 * 2 p2 7 to p2 0 port 3 d 15 to d 8 d 15 to d 8 d 15 to d 8 d 15 to d 8 d 15 to d 8 d 15 to d 8 p3 7 to p3 0 port 4 p4 7 to p4 0 * 1 d 7 to d 0 * 1 p4 7 to p4 0 * 1 d 7 to d 0 * 1 p4 7 to p4 0 * 1 p4 7 to p4 0 * 1 p4 7 to p4 0 port 5 a 19 to a 16 a 19 to a 16 a 19 to a 16 a 19 to a 16 p5 3 to p5 0 * 2 p5 3 to p5 0 * 2 p5 3 to p5 0 port a pa 7 to pa 4 pa 7 to pa 4 pa 7 to pa 5 * 3 , a 20 pa 7 to pa 5 * 3 , a 20 pa 7 to pa 4 pa 7 to pa 5 , a 20 * 3 pa 7 to pa 4 notes: 1. initial state. the bus mode can be switched by settings in abwcr. these pins function as p4 7 to p4 0 in 8-bit bus mode, and as d 7 to d 0 in 16-bit bus mode. 2. initial state. these pins become address output pins when the corresponding bits in the data direction registers (p1ddr, p2ddr, p5ddr) are set to 1. 3. initial state. a 20 is always an address output pin. pa 7 to pa 5 are switched over to a 23 to a 21 output by writing 0 in bits 7 to 5 of brcr. 3.6 memory map in each operating mode figure 3.1 shows a memory map of the h8/3048b group. the address space is divided into eight areas. the initial bus mode differs between modes 1 and 2, and also between modes 3 and 4. the address locations of the on-chip ram and internal i/o registers differ between the 1-mbyte modes (modes 1, 2, 5, and 7) and 16-mbyte modes (modes 3, 4, and 6). the address range specifiable by the cpu in the 8- and 16-bit absolute addressing modes (@aa:8 and @aa:16) also differs.
section 3 mcu operating modes rev. 3.00 sep 27, 2006 page 78 of 872 rej09b0325-0300 h'00000 h'000ff h'07fff memory-indirect branch addresses 16-bit absolute addresses modes 1 and 2 (1-mbyte expanded modes with on-chip rom disabled) h'1ffff h'20000 h'3ffff h'40000 h'5ffff h'60000 h'7ffff h'80000 h'9ffff h'a0000 h'bffff h'c0000 h'dffff h'e0000 area 0 area 1 area 2 area 3 area 4 area 5 area 6 area 7 external address space vector area on-chip ram * external address space internal i/o registers 8-bit absolute addresses 16-bit absolute addresses h'f8000 h'fef0f h'fef10 h'fff00 h'fff0f h'fff10 h'fff1b h'fff1c h'fffff note: * external addresses can be accessed by disabling on-chip ram. modes 3 and 4 (16-mbyte expanded modes with on-chip rom disabled) h'000000 h'0000ff h'007fff memory-indirect branch addresses 16-bit absolute addresses h'1fffff h'200000 area 0 area 1 area 2 area 3 area 4 area 5 area 6 area 7 external address space vector area on-chip ram * external address space internal i/o registers 8-bit absolute addresses 16-bit absolute addresses h'ff8000 h'ffef0f h'ffef10 h'ffff00 h'ffff0f h'ffff10 h'ffff1b h'ffff1c h'ffffff h'3fffff h'400000 h'5fffff h'600000 h'7fffff h'800000 h'9fffff h'a00000 h'bfffff h'c00000 h'dfffff h'e00000 figure 3.1 h8/3048b group memory map in each operating mode
section 3 mcu operating modes rev. 3.00 sep 27, 2006 page 79 of 872 rej09b0325-0300 h'00000 h'000ff h'07fff memory-indirect branch addresses 16-bit absolute addresses mode 5 (1-mbyte expanded mode with on-chip rom enabled) mode 6 (16-mbyte expanded mode with on-chip rom enabled) mode 7 (single-chip advanced mode) h'1ffff h'20000 h'3ffff h'40000 h'5ffff h'60000 h'7ffff h'80000 h'9ffff h'a0000 h'bffff h'c0000 h'dffff h'e0000 area 0 area 1 area 2 area 3 area 4 area 5 area 6 area 7 external address space vector area on-chip rom on-chip ram * external address space internal i/o registers 8-bit absolute addresses 16-bit absolute addresses h'f8000 h'fef0f h'fef10 h'fff00 h'fff0f h'fff10 h'fff1b h'fff1c h'fffff h'00000 h'000ff h'07fff memory-indirect branch addresses 16-bit absolute addresses vector area on-chip rom on-chip ram internal i/o registers 8-bit absolute addresses 16-bit absolute addresses h'fef10 h'fff00 h'fff0f h'fff1c h'fffff h'1ffff h'f8000 note: * external addresses can be accessed by disabling on-chip ram. on-chip rom h'000000 h'0000ff h'007fff memory-indirect branch addresses 16-bit absolute addresses h'1fffff h'200000 area 0 area 1 area 2 area 3 area 4 area 5 area 7 external address space vector area external address space internal i/o registers 8-bit absolute addresses 16-bit absolute addresses h'01ffff h'020000 h'ffef0f h'ffef10 h'ffff00 h'ffff0f h'ffff10 h'ffff1b h'ffff1c h'ffffff h'3fffff h'400000 h'5fffff h'600000 h'7fffff h'800000 h'9fffff h'a00000 h'bfffff h'c00000 h'dfffff h'e00000 on-chip ram * area 6 h'ff8000 figure 3.1 h8/3048b group memory map in each operating mode (cont)
section 3 mcu operating modes rev. 3.00 sep 27, 2006 page 80 of 872 rej09b0325-0300
section 4 exception handling rev. 3.00 sep 27, 2006 page 81 of 872 rej09b0325-0300 section 4 exception handling 4.1 overview 4.1.1 exception handling types and priority as table 4.1 indicates, exception handling may be caused by a reset, trap instruction, or interrupt. exception handling is prioritized as shown in table 4.1. if two or more exceptions occur simultaneously, they are accepted and processed in priority order. trap instruction exceptions are accepted at all times in the program execution state. table 4.1 exception types and priority priority exception type start of exception handling high reset starts immediately after a low-to-high transition at the res pin interrupt interrupt requests are handled when execution of the current instruction or handling of the current exception is completed low trap instruction (trapa) started by execution of a trap instruction (trapa) 4.1.2 exception handling operation exceptions originate from various sources. trap instructions and interrupts are handled as follows. 1. the program counter (pc) and condition code register (ccr) are pushed onto the stack. 2. the ccr interrupt mask bit is set to 1. 3. a vector address corresponding to the exception source is generated, and program execution starts from the address indicated in that address. note: for a reset exception, steps 2 and 3 above are carried out.
section 4 exception handling rev. 3.00 sep 27, 2006 page 82 of 872 rej09b0325-0300 4.1.3 exception vector table the exception sources are classified as shown in figure 4.1. different vectors are assigned to different exception sources. table 4.2 lists the exception sources and their vector addresses. exception sources  reset  interrupts  trap instruction external interrupts: internal interrupts: nmi, irq to irq 30 interrupts from on-chip supporting modules 0 5 figure 4.1 exception sources
section 4 exception handling rev. 3.00 sep 27, 2006 page 83 of 872 rej09b0325-0300 table 4.2 exception vector table exception source vector number vector address * 1 reset 0 h'0000 to h'0003 reserved for system use 1 h'0004 to h'0007 2 h'0008 to h'000b 3 h'000c to h'000f 4 h'0010 to h'0013 5 h'0014 to h'0017 6 h'0018 to h'001b external interrupt (nmi) 7 h'001c to h'001f trap instruction (4 sources) 8 h'0020 to h'0023 9 h'0024 to h'0027 10 h'0028 to h'002b 11 h'002c to h'002f external interrupt irq 0 12 h'0030 to h'0033 external interrupt irq 1 13 h'0034 to h'0037 external interrupt irq 2 14 h'0038 to h'003b external interrupt irq 3 15 h'003c to h'003f external interrupt irq 4 16 h'0040 to h'0043 external interrupt irq 5 17 h'0044 to h'0047 reserved for system use 18 h'0048 to h'004b 19 h'004c to h'004f internal interrupts * 2 20 to 60 h'0050 to h'0053 to h'00f0 to h'00f3 notes: 1. lower 16 bits of the address. 2. for the internal interrupt vectors, see section 5.3.3, interrupt vector table.
section 4 exception handling rev. 3.00 sep 27, 2006 page 84 of 872 rej09b0325-0300 4.2 reset 4.2.1 overview a reset is the highest-priority exception. when the res pin goes low, all processing halts and the chip enters the reset state. a reset initializes the internal state of the cpu and the registers of the on-chip supporting modules. reset exception handling begins when the res pin changes from low to high. the chip can also be reset by overflow of the watchdog timer. for details see section 12, watchdog timer. 4.2.2 reset sequence the chip enters the reset state when the res pin goes low. to ensure that the chip is reset properly, hold the res pin low for at least 20 ms at power-up. to reset the chip during operation, hold the res pin low for at least 20 system clock ( ) cycles. see appendix d.2, pin states at reset, for the states of the pins in the reset state. when the res pin goes high after being held low for the necessary time, the chip starts reset exception handling as follows. ? the internal state of the cpu and the registers of the on-chip supporting modules are initialized, and the i bit is set to 1 in ccr. ? the contents of the reset vector address (h'0000 to h'0003) are read, and program execution starts from the address indicated in the vector address. figure 4.2 shows the reset sequence in modes 1 and 3. figure 4.3 shows the reset sequence in modes 2 and 4. figure 4.4 shows the reset sequence in modes 5, 6, and 7.
section 4 exception handling rev. 3.00 sep 27, 2006 page 85 of 872 rej09b0325-0300 address bus res rd hwr d to d 15 8 vector fetch internal processing prefetch of first program instruction (1), (3), (5), (7) (2), (4), (6), (8) (9) (10) note: after a reset, the wait-state controller inserts three wait states in every bus cycle. address of reset vector: (1) = h'00000, (3) = h'00001, (5) = h'00002, (7) = h'00003 start address (contents of reset vector) start address first instruction of program high (1) (3) (5) (7) (9) (2) (4) (6) (8) (10) lwr , figure 4.2 reset sequence (modes 1 and 3)
section 4 exception handling rev. 3.00 sep 27, 2006 page 86 of 872 rej09b0325-0300 address bus res rd hwr d to d 15 0 vector fetch internal processing prefetch of first program instruction (1), (3) (2), (4) (5) (6) note: after a reset, the wait-state controller inserts three wait states in every bus cycle. high lwr , address of reset vector: (1) = h'000000, (3) = h'000002 start address (contents of reset vector) start address first instruction of program (2) (4) (3) (1) (5) (6) figure 4.3 reset sequence (modes 2 and 4)
section 4 exception handling rev. 3.00 sep 27, 2006 page 87 of 872 rej09b0325-0300 vector fetch internal processing prefetch of first program instruction internal address bus res internal read signal internal write signal internal data bus (16 bits wide) (1) (3) (5) (2) (4) (6) (1), (3) (2), (4) (5) (6) address of reset vector ((1) = h'000000, (2) = h'000002) start address (contents of reset vector) start address first instruction of program figure 4.4 reset sequence (modes 5, 6, and 7) 4.2.3 interrupts after reset if an interrupt is accepted after a reset but before the stack pointer (sp) is initialized, pc and ccr will not be saved correctly, leading to a program crash. to prevent this, all interrupt requests, including nmi, are disabled immediately after a reset. the first instruction of the program is always executed immediately after the reset state ends. this instruction should initialize the stack pointer (example: mov.l #xx:32, sp).
section 4 exception handling rev. 3.00 sep 27, 2006 page 88 of 872 rej09b0325-0300 4.3 interrupts interrupt exception handling can be requested by seven external sources (nmi, irq 0 to irq 5 ) and 30 internal sources in the on-chip supporting modules. figure 4.5 classifies the interrupt sources and indicates the number of interrupts of each type. the on-chip supporting modules that can request interrupts are the watchdog timer (wdt), refresh controller, 16-bit integrated timer unit (itu), dma controller (dmac), serial communication interface (sci), and a/d converter. each interrupt source has a separate vector address. nmi is the highest-priority interrupt and is always accepted * . interrupts are controlled by the interrupt controller. the interrupt controller can assign interrupts other than nmi to two priority levels, and arbitrate between simultaneous interrupts. interrupt priorities are assigned in interrupt priority registers a and b (ipra and iprb) in the interrupt controller. for details on interrupts see section 5, interrupt controller. note: * for the h8/3048f-one (single power supply with flash memory), the nmi input may be prohibited. for details, refer to section 18.8.4, nmi input disable conditions. interrupts external interrupts internal interrupts nmi (1) irq to irq (6) wdt * 1 (1) refresh controller * 2 (1) itu (15) dmac (4) sci (8) a/d converter (1) notes: numbers in parentheses are the number of interrupt sources. 1. 2. when the watchdog timer is used as an interval timer, it generates an interrupt request at every counter overflow. when the refresh controller is used as an interval timer, it generates an interrupt request at compare match. 0 5 figure 4.5 interrupt sources and number of interrupts
section 4 exception handling rev. 3.00 sep 27, 2006 page 89 of 872 rej09b0325-0300 4.4 trap instruction trap instruction exception handling starts when a trapa instruction is executed. if the ue bit is set to 1 in the system control register (syscr), the exception handling sequence sets the i bit to 1 in ccr. if the ue bit is 0, the i and ui bits are both set to 1. the trapa instruction fetches a start address from a vector table entry corresponding to a vector number from 0 to 3, which is specified in the instruction code. 4.5 stack status after exception handling figure 4.6 shows the stack after completion of trap instruction exception handling and interrupt exception handling. sp-4 sp-3 sp-2 sp-1 sp (er7) sp (er7) sp+1 sp+2 sp+3 sp+4 before exception handling after exception handling stack area ccr pc pc pc e h l even address pushed on stack legend: pce: pch: pcl: ccr: sp: notes: pc indicates the address of the first instruction that will be executed after return. registers must be saved in word or longword size at even addresses. 1. 2. bits 23 to 16 of program counter (pc) bits 15 to 8 of program counter (pc) bits 7 to 0 of program counter (pc) condition code register stack pointer figure 4.6 stack after completion of exception handling
section 4 exception handling rev. 3.00 sep 27, 2006 page 90 of 872 rej09b0325-0300 4.6 notes on stack usage when accessing word data or longword data, the h8/3048b group regards the lowest address bit as 0. the stack should always be accessed by word access or longword access, and the value of the stack pointer (sp:er7) should always be kept even. use the following instructions to save registers: push.w rn (or mov.w rn, @?sp) push.l ern (or mov.l ern, @?sp) use the following instructions to restore registers: pop.w rn (or mov.w @sp+, rn) pop.l ern (or mov.l @sp+, ern) setting sp to an odd value may lead to a malfunction. figure 4.7 shows an example of what happens when the sp value is odd. trapa instruction executed ccr legend: ccr: pc: r1l: sp: sp pc r1l pc sp sp mov. b r1l, @-er7 sp set to h'fffeff data saved above sp ccr contents lost condition code register program counter general register r1l stack pointer note: the diagram illustrates modes 3 and 4. h'fffefa h'fffefb h'fffefc h'fffefd h'fffeff figure 4.7 operation when sp value is odd
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 91 of 872 rej09b0325-0300 section 5 interrupt controller 5.1 overview 5.1.1 features the interrupt controller has the following features: ? interrupt priority registers (iprs) for setting interrupt priorities interrupts other than nmi can be assigned to two priority levels on a module-by-module basis in interrupt priority registers a and b (ipra and iprb). ? three-level masking by the i and ui bits in the cpu condition code register (ccr) ? independent vector addresses all interrupts are independently vectored; the interrupt service routine does not have to identify the interrupt source. ? seven external interrupt pins nmi has the highest priority and is always accepted * ; either the rising or falling edge can be selected. for each of irq 0 to irq 5 , sensing of the falling edge or level sensing can be selected independently. note: * for the h8/3048f-one (single power supply with flash memory), the nmi input may be prohibited. for details, refer to section 18.8.4, nmi input disable conditions.
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 92 of 872 rej09b0325-0300 5.1.2 block diagram figure 5.1 shows a block diagram of the interrupt controller. iscr ier ipra, iprb . . . ovf tme adi adie . . . . . . . cpu ccr i ui ue syscr iscr: ier: isr: ipra: iprb: syscr: nmi input irq input irq input section isr interrupt controller priority decision logic interrupt request vector number irq sense control register irq enable register irq status register interrupt priority register a interrupt priority register b system control register legend: figure 5.1 interrupt controller block diagram
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 93 of 872 rej09b0325-0300 5.1.3 pin configuration table 5.1 lists the interrupt pins. table 5.1 interrupt pins name abbreviation i/o function nonmaskable interrupt nmi input nonmaskable interrupt * , rising edge or falling edge selectable external interrupt request 5 to 0 irq 5 to irq 0 input maskable interrupts, falling edge or level sensing selectable note: * for the h8/3048f-one (single power supply with flash memory), the nmi input may be prohibited. for details, refer to section 18.8.4, nmi input disable conditions. 5.1.4 register configuration table 5.2 lists the registers of the interrupt controller. table 5.2 interrupt controller registers address * 1 name abbreviation r/w initial value h'fff2 system control register syscr r/w h'0b h'fff4 irq sense control register iscr r/w h'00 h'fff5 irq enable register ier r/w h'00 h'fff6 irq status register isr r/(w) * 2 h'00 h'fff8 interrupt priority register a ipra r/w h'00 h'fff9 interrupt priority register b iprb r/w h'00 notes: 1. lower 16 bits of the address. 2. only 0 can be written, to clear flags.
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 94 of 872 rej09b0325-0300 5.2 register descriptions 5.2.1 system control register (syscr) syscr is an 8-bit readable/writable register that controls software standby mode, selects the action of the ui bit in ccr, selects the nmi edge, and enables or disables the on-chip ram. only bits 3 and 2 are described here. for the other bits, see section 3.3, system control register (syscr). syscr is initialized to h'0b by a reset and in hardware standby mode. it is not initialized in software standby mode. bit initial value read/write 7 ssby 0 r/w 6 sts2 0 r/w 5 sts1 0 r/w 4 sts0 0 r/w 3 ue 1 r/w 0 rame 1 r/w 2 nmieg 0 r/w 1 ? 1 ? software standby standby timer select 2 to 0 user bit enable selects whether to use the ui bit in ccr as a user bit or interrupt mask bit nmi edge select selects the nmi input edge reserved bit ram enable
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 95 of 872 rej09b0325-0300 bit 3?user bit enable (ue): selects whether to use the ui bit in ccr as a user bit or an interrupt mask bit. bit 3: ue description 0 ui bit in ccr is used as interrupt mask bit 1 ui bit in ccr is used as user bit (initial value) bit 2?nmi edge select (nmieg): selects the nmi input edge. bit 2: nmieg description 0 interrupt is requested at falling edge of nmi input (initial value) 1 interrupt is requested at rising edge of nmi input 5.2.2 interrupt priority registers a and b (ipra, iprb) ipra and iprb are 8-bit readable/writable registers that control interrupt priority.
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 96 of 872 rej09b0325-0300 interrupt priority register a (ipra) ipra is an 8-bit readable/writable register in which interrupt priority levels can be set. bit initial value read/write 7 ipra7 0 r/w 6 ipra6 0 r/w 5 ipra5 0 r/w 4 ipra4 0 r/w 3 ipra3 0 r/w 0 ipra0 0 r/w 2 ipra2 0 r/w 1 ipra1 0 r/w priority level a7 selects the priority level of irq interrupt requests priority level a3 selects the priority level of wdt and refresh controller interrupt requests priority level a2 selects the priority level of itu channel 0 interrupt requests priority level a1 selects the priority level of itu channel 1 interrupt requests priority level a0 selects the priority level of itu channel 2 interrupt requests selects the priority level of irq interrupt requests priority level a6 selects the priority level of irq and irq interrupt requests priority level a5 selects the priority level of irq and irq interrupt requests priority level a4 0 1 23 45 ipra is initialized to h'00 by a reset and in hardware standby mode.
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 97 of 872 rej09b0325-0300 bit 7?priority level a7 (ipra7): selects the priority level of irq 0 interrupt requests. bit 7: ipra7 description 0irq 0 interrupt requests have priority level 0 (low priority) (initial value) 1irq 0 interrupt requests have priority level 1 (high priority) bit 6?priority level a6 (ipra6): selects the priority level of irq 1 interrupt requests. bit 6: ipra6 description 0irq 1 interrupt requests have priority level 0 (low priority) (initial value) 1irq 1 interrupt requests have priority level 1 (high priority) bit 5?priority level a5 (ipra5): selects the priority level of irq 2 and irq 3 interrupt requests. bit 5: ipra5 description 0irq 2 and irq 3 interrupt requests have priority level 0 (low priority) (initial value) 1irq 2 and irq 3 interrupt requests have priority level 1 (high priority) bit 4?priority level a4 (ipra4): selects the priority level of irq 4 and irq 5 interrupt requests. bit 4: ipra4 description 0irq 4 and irq 5 interrupt requests have priority level 0 (low priority) (initial value) 1irq 4 and irq 5 interrupt requests have priority level 1 (high priority) bit 3?priority level a3 (ipra3): selects the priority level of wdt and refresh controller interrupt requests. bit 3: ipra3 description 0 wdt and refresh controller interrupt requests have priority level 0 (low priority) (initial value) 1 wdt and refresh controller interrupt requests have priority level 1 (high priority)
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 98 of 872 rej09b0325-0300 bit 2?priority level a2 (ipra2): selects the priority level of itu channel 0 interrupt requests. bit 2: ipra2 description 0 itu channel 0 interrupt requests have priority level 0 (low priority) (initial value) 1 itu channel 0 interrupt requests have priority level 1 (high priority) bit 1?priority level a1 (ipra1): selects the priority level of itu channel 1 interrupt requests. bit 1: ipra1 description 0 itu channel 1 interrupt requests have priority level 0 (low priority) (initial value) 1 itu channel 1 interrupt requests have priority level 1 (high priority) bit 0?priority level a0 (ipra0): selects the priority level of itu channel 2 interrupt requests. bit 0: ipra0 description 0 itu channel 2 interrupt requests have priority level 0 (low priority) (initial value) 1 itu channel 2 interrupt requests have priority level 1 (high priority)
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 99 of 872 rej09b0325-0300 interrupt priority register b (iprb) iprb is an 8-bit readable/writable register in which interrupt priority levels can be set. bit initial value read/write 7 iprb7 0 r/w 6 iprb6 0 r/w 5 iprb5 0 r/w 4 ? 0 r/w 3 iprb3 0 r/w 0 ? 0 r/w 2 iprb2 0 r/w 1 iprb1 0 r/w priority level b7 selects the priority level of itu channel 3 interrupt requests priority level b3 selects the priority level of sci channel 0 interrupt requests priority level b2 selects the priority level of sci channel 1 interrupt requests priority level b1 selects the priority level of a/d converter interrupt request reserved bit selects the priority level of itu channel 4 interrupt requests priority level b6 selects the priority level of dmac interrupt requests (channels 0 and 1) priority level b5 reserved bit iprb is initialized to h'00 by a reset and in hardware standby mode.
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 100 of 872 rej09b0325-0300 bit 7?priority level b7 (iprb7): selects the priority level of itu channel 3 interrupt requests. bit 7: iprb7 description 0 itu channel 3 interrupt requests have priority level 0 (low priority) (initial value) 1 itu channel 3 interrupt requests have priority level 1 (high priority) bit 6?priority level b6 (iprb6): selects the priority level of itu channel 4 interrupt requests. bit 6: iprb6 description 0 itu channel 4 interrupt requests have priority level 0 (low priority) (initial value) 1 itu channel 4 interrupt requests have priority level 1 (high priority) bit 5?priority level b5 (iprb5): selects the priority level of dmac interrupt requests (channels 0 and 1). bit 5: iprb5 description 0 dmac interrupt requests (channels 0 and 1) have priority level 0 (low priority) (initial value) 1 dmac interrupt requests (channels 0 and 1) have priority level 1 (high priority) bit 4?reserved: this bit can be written and read, but it does not affect interrupt priority.
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 101 of 872 rej09b0325-0300 bit 3?priority level b3 (iprb3): selects the priority level of sci channel 0 interrupt requests. bit 3: iprb3 description 0 sci0 interrupt requests have priority level 0 (low priority) (initial value) 1 sci0 interrupt requests have priority level 1 (high priority) bit 2?priority level b2 (iprb2): selects the priority level of sci channel 1 interrupt requests. bit 2: iprb2 description 0 sci1 interrupt requests have priority level 0 (low priority) (initial value) 1 sci1 interrupt requests have priority level 1 (high priority) bit 1?priority level b1 (iprb1): selects the priority level of a/d converter interrupt requests. bit 1: iprb1 description 0 a/d converter interrupt requests have priority level 0 (low priority) (initial value) 1 a/d converter interrupt requests have priority level 1 (high priority) bit 0?reserved: this bit can be written and read, but it does not affect interrupt priority.
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 102 of 872 rej09b0325-0300 5.2.3 irq status register (isr) isr is an 8-bit readable/writable register that indicates the status of irq 0 to irq 5 interrupt requests. bit initial value read/write 7 ? 0 ? these bits indicate irq to irq interrupt request status note: * only 0 can be written, to clear flags. 6 ? 0 ? 5 irq5f 0 r/(w) * 4 irq4f 0 r/(w) * 3 irq3f 0 r/(w) * 2 irq2f 0 r/(w) * 1 irq1f 0 r/(w) * 0 irq0f 0 r/(w) * 50 irq to irq flags 50 reserved bits isr is initialized to h'00 by a reset and in hardware standby mode. bits 7 and 6?reserved: read-only bits, always read as 0. bits 5 to 0?irq 5 to irq 0 flags (irq5f to irq0f): these bits indicate the status of irq 5 to irq 0 interrupt requests. bits 5 to 0: irq5f to irq0f description 0 [clearing conditions] (initial value) 0 is written in irqnf after reading the irqnf flag when irqnf = 1. irqnsc = 0, irqn input is high, and interrupt exception handling is carried out. irqnsc = 1 and irqn interrupt exception handling is carried out. 1 [setting conditions] irqnsc = 0 and irqn input is low. irqnsc = 1 and irqn input changes from high to low. note: n = 5 to 0
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 103 of 872 rej09b0325-0300 5.2.4 irq enable register (ier) ier is an 8-bit readable/writable register that enables or disables irq 0 to irq 5 interrupt requests. bit initial value read/write 7 ? 0 r/w these bits enable or disable irq to irq interrupts 6 ? 0 r/w 5 irq5e 0 r/w 4 irq4e 0 r/w 3 irq3e 0 r/w 2 irq2e 0 r/w 1 irq1e 0 r/w 0 irq0e 0 r/w 50 irq to irq enable 50 reserved bits ier is initialized to h'00 by a reset and in hardware standby mode. bits 7 and 6?reserved: these bits can be written and read, but they do not enable or disable interrupts. bits 5 to 0?irq 5 to irq 0 enable (irq5e to irq0e): these bits enable or disable irq 5 to irq 0 interrupts. bits 5 to 0: irq5e to irq0e description 0irq 5 to irq 0 interrupts are disabled (initial value) 1irq 5 to irq 0 interrupts are enabled
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 104 of 872 rej09b0325-0300 5.2.5 irq sense control register (iscr) iscr is an 8-bit readable/writable register that selects level sensing or falling-edge sensing of the inputs at pins irq 5 to irq 0 . bit initial value read/write 7 ? 0 r/w these bits select level sensing or falling-edge sensing for irq to irq interrupts 6 ? 0 r/w 5 irq5sc 0 r/w 4 irq4sc 0 r/w 3 irq3sc 0 r/w 2 irq2sc 0 r/w 1 irq1sc 0 r/w 0 irq0sc 0 r/w 50 irq to irq sense control 50 reserved bits iscr is initialized to h'00 by a reset and in hardware standby mode. bits 7 and 6?reserved: these bits can be written and read, but they do not select level or falling-edge sensing. bits 5 to 0?irq 5 to irq 0 sense control (irq5sc to irq0sc): these bits select whether interrupts irq 5 to irq 0 are requested by level sensing of pins irq 5 to irq 0 , or by falling-edge sensing. bits 5 to 0: irq5sc to irq0sc description 0 interrupts are requested when irq 5 to irq 0 inputs are low (initial value) 1 interrupts are requested by falling-edge input at irq 5 to irq 0
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 105 of 872 rej09b0325-0300 5.3 interrupt sources the interrupt sources include external interrupts (nmi, irq 0 to irq 5 ) and 30 internal interrupts. 5.3.1 external interrupts there are seven external interrupts: nmi, and irq 0 to irq 5 . of these, nmi, irq 0 , irq 1 , and irq 2 can be used to exit software standby mode. nmi nmi is the highest-priority interrupt and is always accepted, regardless of the states of the i and ui bits in ccr. the nmieg bit in syscr selects whether an interrupt is requested by the rising or falling edge of the input at the nmi pin * . nmi interrupt exception handling has vector number 7. note: * for the h8/3048f-one (single power supply with flash memory), the nmi input may be prohibited. for details, refer to section 18.8.4, nmi input disable conditions. irq 0 to irq 5 interrupts these interrupts are requested by input signals at pins irq 0 to irq 5 . the irq 0 to irq 5 interrupts have the following features. ? iscr settings can select whether an interrupt is requested by the low level of the input at pins irq 0 to irq 5 , or by the falling edge. ? ier settings can enable or disable the irq 0 to irq 5 interrupts. interrupt priority levels can be assigned by four bits in ipra (ipra7 to ipra4). ? the status of irq 0 to irq 5 interrupt requests is indicated in isr. the isr flags can be cleared to 0 by software. figure 5.2 shows a block diagram of interrupts irq 0 to irq 5 .
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 106 of 872 rej09b0325-0300 input edge/level sense circuit irqnsc irqnf s r q irqne irqn interrupt request clear signal irqn note: n = 5 to 0 figure 5.2 block diagram of interrupts irq 0 to irq 5 figure 5.3 shows the timing of the setting of the interrupt flags (irqnf). irqn irqnf input pin note: n = 5 to 0 figure 5.3 timing of setting of irqnf interrupts irq 0 to irq 5 have vector numbers 12 to 17. these interrupts are detected regardless of whether the corresponding pin is set for input or output. when using a pin for external interrupt input, clear its ddr bit to 0 and do not use the pin for chip select output, refresh output, or sci input or output.
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 107 of 872 rej09b0325-0300 5.3.2 internal interrupts thirty internal interrupts are requested from the on-chip supporting modules. ? each on-chip supporting module has status flags for indicating interrupt status, and enable bits for enabling or disabling interrupts. ? interrupt priority levels can be assigned in ipra and iprb. ? itu and sci interrupt requests can activate the dmac, in which case no interrupt request is sent to the interrupt controller, and the i and ui bits are disregarded. 5.3.3 interrupt vector table table 5.3 lists the interrupt sources, their vector addresses, and their default priority order. in the default priority order, smaller vector numbers have higher priority. the priority of interrupts other than nmi can be changed in ipra and iprb. the priority order after a reset is the default order shown in table 5.3.
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 108 of 872 rej09b0325-0300 table 5.3 interrupt sources, vector addresses, and priority interrupt source origin vector number vector address * ipr priority nmi external pins 7 h'001c to h'001f ? high irq 0 12 h'0030 to h'0033 ipra7 irq 1 13 h'0034 to h0037 ipra6 irq 2 14 h'0038 to h'003b ipra5 irq 3 15 h'003c to h'003f irq 4 16 h'0040 to h'0043 ipra4 irq 5 17 h'0044 to h'0047 reserved ? 18 h'0048 to h'004b 19 h'004c to h'004f wovi (interval timer) watchdog timer 20 h'0050 to h'0053 ipra3 cmi (compare match) refresh controller 21 h'0054 to h'0057 reserved ? 22 h'0058 to h'005b 23 h'005c to h'005f imia0 (compare match/ input capture a0) itu channel 0 24 h'0060 to h'0063 ipra2 imib0 (compare match/ input capture b0) 25 h'0064 to h'0067 ovi0 (overflow 0) 26 h'0068 to h'006b reserved ? 27 h'006c to h'006f imia1 (compare match/ input capture a1) itu channel 1 28 h'0070 to h'0073 ipra1 imib1 (compare match/ input capture b1) 29 h'0074 to h'0077 ovi1 (overflow 1) 30 h'0078 to h'007b reserved ? 31 h'007c to h'007f low
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 109 of 872 rej09b0325-0300 interrupt source origin vector number vector address * ipr priority imia2 (compare match/ input capture a2) itu channel 2 32 h'0080 to h'0083 ipra0 high imib2 (compare match/ input capture b2) 33 h'0084 to h'0087 ovi2 (overflow 2) 34 h'0088 to h'008b reserved ? 35 h'008c to h'008f imia3 (compare match/ input capture a3) itu channel 3 36 h'0090 to h'0093 iprb7 imib3 (compare match/ input capture b3) 37 h'0094 to h'0097 ovi3 (overflow 3) 38 h'0098 to h'009b reserved ? 39 h'009c to h'009f imia4 (compare match/ input capture a4) itu channel 4 40 h'00a0 to h'00a3 iprb6 imib4 (compare match/ input capture b4) 41 h'00a4 to h'00a7 ovi4 (overflow 4) 42 h'00a8 to h'00ab reserved ? 43 h'00ac to h'00af dend0a dmac 44 h'00b0 to h'00b3 iprb5 dend0b 45 h'00b4 to h'00b7 dend1a 46 h'00b8 to h'00bb dend1b 47 h'00bc to h'00bf reserved ? 48 h'00c0 to h'00c3 ? 49 h'00c4 to h'00c7 50 h'00c8 to h'00cb 51 h'00cc to h'00cf low
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 110 of 872 rej09b0325-0300 interrupt source origin vector number vector address * ipr priority eri0 (receive error 0) sci channel 0 52 h'00d0 to h'00d3 iprb3 high rxi0 (receive data full 0) 53 h'00d4 to h'00d7 txi0 (transmit data empty 0) 54 h'00d8 to h'00db tei0 (transmit end 0) 55 h'00dc to h'00df eri1 (receive error 1) sci channel 1 56 h'00e0 to h'00e3 iprb2 rxi1 (receive data full 1) 57 h'00e4 to h'00e7 txi1 (transmit data empty 1) 58 h'00e8 to h'00eb tei1 (transmit end 1) 59 h'00ec to h'00ef adi (a/d end) a/d 60 h'00f0 to h'00f3 iprb1 low note: * lower 16 bits of the address.
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 111 of 872 rej09b0325-0300 5.4 interrupt operation 5.4.1 interrupt handling process the h8/3048b group handles interrupts differently depending on the setting of the ue bit. when ue = 1, interrupts are controlled by the i bit. when ue = 0, interrupts are controlled by the i and ui bits. table 5.4 indicates how interrupts are handled for all setting combinations of the ue, i, and ui bits. nmi interrupts are always accepted except in the reset and hardware standby states * . irq interrupts and interrupts from the on-chip supporting modules have their own enable bits. interrupt requests are ignored when the enable bits are cleared to 0. note: * for the h8/3048f-one (single power supply with flash memory), the nmi input may be prohibited. for details, refer to section 18.8.4, nmi input disable conditions. table 5.4 ue, i, and ui bit settings and interrupt handling syscr ccr ue i ui description 1 0 ? all interrupts are accepted. interrupts with priority level 1 have higher priority. 1 ? no interrupts are accepted except nmi. 0 0 ? all interrupts are accepted. interrupts with priority level 1 have higher priority. 1 0 nmi and interrupts with priority level 1 are accepted. 1 no interrupts are accepted except nmi. ue = 1 interrupts irq 0 to irq 5 and interrupts from the on-chip supporting modules can all be masked by the i bit in the cpu?s ccr. interrupts are masked when the i bit is set to 1, and unmasked when the i bit is cleared to 0. interrupts with priority level 1 have higher priority. figure 5.4 is a flowchart showing how interrupts are accepted when ue = 1.
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 112 of 872 rej09b0325-0300 program execution state interrupt requested? nmi no yes no yes no priority level 1? no irq 0 yes no irq 1 yes adi yes no irq 0 yes no irq 1 yes adi yes no i = 0 yes save pc and ccr i 1 branch to interrupt service routine figure 5.4 process up to interrupt acceptance when ue = 1
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 113 of 872 rej09b0325-0300 ? if an interrupt condition occurs and the corresponding interrupt enable bit is set to 1, an interrupt request is sent to the interrupt controller. ? when the interrupt controller receives one or more interrupt requests, it selects the highest- priority request, following the ipr interrupt priority settings, and holds other requests pending. if two or more interrupts with the same ipr setting are requested simultaneously, the interrupt controller follows the priority order shown in table 5.3. ? the interrupt controller checks the i bit. if the i bit is cleared to 0, the selected interrupt request is accepted. if the i bit is set to 1, only nmi is accepted; other interrupt requests are held pending. ? when an interrupt request is accepted, interrupt exception handling starts after execution of the current instruction has been completed. ? in interrupt exception handling, pc and ccr are saved to the stack area. the pc value that is saved indicates the address of the first instruction that will be executed after the return from the interrupt service routine. ? next the i bit is set to 1 in ccr, masking all interrupts except nmi. ? the vector address of the accepted interrupt is generated, and the interrupt service routine starts executing from the address indicated by the contents of the vector address. ue = 0 the i and ui bits in the cpu?s ccr and the ipr bits enable three-level masking of irq 0 to irq 5 interrupts and interrupts from the on-chip supporting modules. ? interrupt requests with priority level 0 are masked when the i bit is set to 1, and are unmasked when the i bit is cleared to 0. ? interrupt requests with priority level 1 are masked when the i and ui bits are both set to 1, and are unmasked when either the i bit or the ui bit is cleared to 0. for example, if the interrupt enable bits of all interrupt requests are set to 1, ipra is set to h'20, and iprb is set to h'00 (giving irq 2 and irq 3 interrupt requests priority over other interrupts), interrupts are masked as follows: a. if i = 0, all interrupts are unmasked (priority order: nmi > irq 2 > irq 3 >irq 0 ?). b. if i = 1 and ui = 0, only nmi, irq 2 , and irq 3 are unmasked. c. if i = 1 and ui = 1, all interrupts are masked except nmi. figure 5.5 shows the transitions among the above states.
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 114 of 872 rej09b0325-0300 all interrupts are unmasked only nmi, irq , and irq are unmasked exception handling, or i 1, ui 1 a. b. 2 3 all interrupts are masked except nmi c. ui 0 i 0 exception handling, or ui 1 i 0 i 1, ui 0 figure 5.5 interrupt masking state transitions (example) figure 5.6 is a flowchart showing how interrupts are accepted when ue = 0. ? if an interrupt condition occurs and the corresponding interrupt enable bit is set to 1, an interrupt request is sent to the interrupt controller. ? when the interrupt controller receives one or more interrupt requests, it selects the highest- priority request, following the ipr interrupt priority settings, and holds other requests pending. if two or more interrupts with the same ipr setting are requested simultaneously, the interrupt controller follows the priority order shown in table 5.3. ? the interrupt controller checks the i bit. if the i bit is cleared to 0, the selected interrupt request is accepted regardless of its ipr setting, and regardless of the ui bit. if the i bit is set to 1 and the ui bit is cleared to 0, only nmi and interrupts with priority level 1 are accepted; interrupt requests with priority level 0 are held pending. if the i bit and ui bit are both set to 1, only nmi is accepted; all other interrupt requests are held pending. ? when an interrupt request is accepted, interrupt exception handling starts after execution of the current instruction has been completed. ? in interrupt exception handling, pc and ccr are saved to the stack area. the pc value that is saved indicates the address of the first instruction that will be executed after the return from the interrupt service routine. ? the i and ui bits are set to 1 in ccr, masking all interrupts except nmi. ? the vector address of the accepted interrupt is generated, and the interrupt service routine starts executing from the address indicated by the contents of the vector address.
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 115 of 872 rej09b0325-0300 program execution state interrupt requested? nmi no yes no yes no priority level 1? no irq 0 yes no irq 1 yes adi yes no irq 0 yes no irq 1 yes adi yes no i = 0 yes no i = 0 yes ui = 0 yes no save pc and ccr i 1, ui 1 figure 5.6 process up to interrupt acceptance when ue = 0
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 116 of 872 rej09b0325-0300 5.4.2 interrupt sequence figure 5.7 shows the interrupt sequence in mode 2 when the program code and stack are in an external memory area accessed in two states via a 16-bit bus. rd hwr d to d 15 0 (1) (2), (4) (3) (5) (7) note: mode 2, with program code and stack in external memory area accessed in two states via 16-bit bus. lwr , interrupt level decision and wait for end of instruction interrupt accepted instruction prefetch internal processing stack vector fetch internal processing prefetch of interrupt service routine instruction high instruction prefetch address (not executed; return address, same as pc contents) instruction code (not executed) instruction prefetch address (not executed) sp ? 2 sp ? 4 (6), (8) (9), (11) (10), (12) (13) (14) pc and ccr saved to stack vector address starting address of interrupt service routine (contents of vector address) starting address of interrupt service routine; (13) = (10), (12) first instruction of interrupt service routine (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12) (13) (14) figure 5.7 interrupt sequence (mode 2, two-state access, stack in external memory)
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 117 of 872 rej09b0325-0300 5.4.3 interrupt response time table 5.5 indicates the interrupt response time from the occurrence of an interrupt request until the first instruction of the interrupt service routine is executed. table 5.5 interrupt response time external memory 8-bit bus 16-bit bus no. item on-chip memory 2 states 3 states 2 states 3 states 1 interrupt priority decision 2 * 1 2 * 1 2 * 1 2 * 1 2 * 1 2 maximum number of states until end of current instruction 1 to 23 * 5 1 to 27 * 5 * 6 1 to 41 * 6 1 to 23 * 5 1 to 25 * 5 3 saving pc and ccr to stack 4812 * 4 46 * 4 4 vector fetch 4 8 12 * 4 46 * 4 5 instruction prefetch * 2 4812 * 4 46 * 4 6 internal processing * 3 444 44 total 19 to 41 31 to 57 43 to 83 19 to 41 25 to 49 notes: 1. 1 state for internal interrupts. 2. prefetch after the interrupt is accepted and prefetch of the first instruction in the interrupt service routine. 3. internal processing after the interrupt is accepted and internal processing after prefetch. 4. the number of states increases if wait states are inserted in external memory access. 5. example for divxs.w rs,erd and mulxs.w rs,erd 6. example for mov.l @(d:24,ers),erd and mov.l ers,@(d:24,erd)
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 118 of 872 rej09b0325-0300 5.5 usage notes 5.5.1 contention between interrupt and interrupt-disabling instruction when an instruction clears an interrupt enable bit to 0 to disable the interrupt, the interrupt is not disabled until after execution of the instruction is completed. if an interrupt occurs while a bclr, mov, or other instruction is being executed to clear its interrupt enable bit to 0, at the instant when execution of the instruction ends the interrupt is still enabled, so its interrupt exception handling is carried out. if a higher-priority interrupt is also requested, however, interrupt exception handling for the higher-priority interrupt is carried out, and the lower-priority interrupt is ignored. this also applies to the clearing of an interrupt flag. figure 5.8 shows an example in which an imiea bit is cleared to 0 in tier of the itu. imia exception handling tier write cycle by cpu figure 5.8 contention between interrupt and interrupt-disabling instruction this type of contention will not occur if the interrupt is masked when the interrupt enable bit or flag is cleared to 0.
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 119 of 872 rej09b0325-0300 5.5.2 instructions that inhibit interrupts the ldc, andc, orc, and xorc instructions inhibit interrupts. when an interrupt occurs, after determining the interrupt priority, the interrupt controller requests a cpu interrupt. if the cpu is currently executing one of these interrupt-inhibiting instructions, however, when the instruction is completed the cpu always continues by executing the next instruction. 5.5.3 interrupts during eepmov instruction execution the eepmov.b and eepmov.w instructions differ in their reaction to interrupt requests. when the eepmov.b instruction is executing a transfer, no interrupts are accepted until the transfer is completed, not even nmi. when the eepmov.w instruction is executing a transfer, interrupt requests other than nmi are not accepted until the transfer is completed. if nmi is requested, nmi exception handling starts at a transfer cycle boundary. the pc value saved on the stack is the address of the next instruction. programs should be coded as follows to allow for nmi interrupts during eepmov.w execution: l1: eepmov.w mov.w r4,r4 bne l1 5.5.4 usage notes on external interrupts the irqnf flag specification calls for the flag to be cleared by writing 0 to it after it has been read while set to 1. however, it is possible for the irqnf flag to be cleared by mistake simply by writing 0 to it, irrespective of whether it has been read while set to 1, with the result that interrupt exception handling is not executed. this occurs when the following conditions are fulfilled. ? setting conditions 1. multiple external interrupts (irqa, irqb) are being used. 2. different clearing methods are being used: clearing by writing 0 for the irqaf flag, and clearing by hardware for the irqbf flag. 3. a bit manipulation instruction is used on the irq status register to clear the irqaf flag, or else isr is read as a byte unit, the irqaf flag bit is cleared, and the values read in the other bits are written as a byte unit.
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 120 of 872 rej09b0325-0300 ? occurrence conditions 1. when irqaf = 1, for the irqaf flag to clear, isr register read is executed. thereafter interrupt processing is carried out and irqbf flag clears. 2. irqaf flag clear and irqbf flag generation compete (irqaf flag setting). (the isr read needed for irqaf flag clear was at irqbf = 0 but in the time taken for isr write, irqbf = 1 was reached.) in all of the setting conditions 1 to 3 and occurrence conditions 1 and 2 are generated, irqbf clears in error during isr write for occurrence condition 2 and interrupt processing is not carried out. however, if irqbf flag reaches 0 between occurrence conditions 1 and 2, irqbf flag does not clear in error. read 1 write 0 read 1 write 1 irqb execution read 1 write 0 read 0 write 0 clear in error occurrence condition 1 irqaf irqbf occurrence condition 2 figure 5.9 irqnf flag when interrupt processing is not conducted
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 121 of 872 rej09b0325-0300 in this situation, conduct one of the following countermeasures. countermeasure 1: when clears irqaf flag, do not use the bit manipulation instruction, read the isr in bytes. then write a value in bytes which sets irqaf flag to 0 and other bits to 1. for example, if a = 0 mov.b @isr,r0l mov.b #hfe,r0l mov.b r0l,@isr countermeasure 2: during irqb interrupt exception processing, carry out irqbf flag clear dummy processing. for example, if b = 1 irqb mov.b #hfd,r0l mov.b r0l,@isr 5.5.5 notes on non-maskable interrupts (nmi) nmi is an exception processing that can be executed by the interrupt controller and cpu when the chip internal circuits are operating normally under a specified electrical characteristics. if an nmi is executed when the circuits are not operating normally due to some factors such as software or abnormal interrupt of input to the pins (runaway execution), the operation will not be guaranteed. incorrect nmi operation factors: software 1. when an interrupt exception processing is executed in an h8/300h cpu, it is assumed that the stack pointer (sp(er7)) has already been set by software, and that the stack pointer (sp(er7)) points to the stack area set in a system such as ram. if the program is in a runaway execution, the stack pointer may be overflowed and updated illegally. therefore, normal operation will not be guaranteed. 2. requests for nmis can be accepted on the rising or falling edge of a pin. acceptance of the rising or falling edge depends on the setting of the bit nmieg in the system control register (syscr). it is necessary for the customer to set the bit according to the designated system. when the program is in a runaway execution, this bit may be rewritten illegally. therefore, the system may not operate as expected.
section 5 interrupt controller rev. 3.00 sep 27, 2006 page 122 of 872 rej09b0325-0300 3. this chip has a break function to implement on-board emulation for specific customers. to use this break function, execute the brk instruction (h'5770). note that the brk instruction is usually undefined. therefore, if the cpu accidentally executes the instruction, the chip will perform exceptional processing and will enter the break mode. in the break mode, interrupts including the nmi are inhibited and the count of the watch dog timer will be stopped. then by executing the rtb (h'56f0) instruction, the break mode will be cancelled, and usual program execution will resume. when the execution is reset during break mode, the cpu enters the reset state and the break mode is cancelled. once the reset has been cancelled, normal program execution will resume after the reset exception processing has been executed. incorrect nmi operation factors: abnormal interrupts input to the chip pins if an abnormal interrupt which was not specified in the electrical characteristics is input to a pin during a chip operation, the chip may be destroyed. in this case, the operation of the chip will not be guaranteed. when an abnormal interrupt has been input to a pin, the chip may not be destroyed; however, the internal circuits of the chip may partially or wholly malfunction, and the cpu may enter an unimagined undefined state when the cpu was designed. if this occurs, it will be impossible to control the operation of the chip by external pins other than the external reset and standby pins, and the operation of the nmi will not be guaranteed. in this case, after some specified signals have been input to the pins, input an external reset so that the chip can enter the normal program execution state again.
section 6 bus controller rev. 3.00 sep 27, 2006 page 123 of 872 rej09b0325-0300 section 6 bus controller 6.1 overview the h8/3048b group has an on-chip bus controller that divides the address space into eight areas and can assign different bus specifications to each. this enables different types of memory to be connected easily. a bus arbitration function of the bus controller controls the operation of the dma controller (dmac) and refresh controller. the bus controller can also release the bus to an external device. 6.1.1 features features of the bus controller are listed below. ? independent settings for address areas 7 to 0 ? 128-kbyte areas in 1-mbyte modes; 2-mbyte areas in 16-mbyte modes. ? chip select signals ( cs 7 to cs 0 ) can be output for areas 7 to 0. ? areas can be designated for 8-bit or 16-bit access. ? areas can be designated for two-state or three-state access. ? four wait modes ? programmable wait mode, pin auto-wait mode, and pin wait modes 0 and 1 can be selected. ? zero to three wait states can be inserted automatically. ? bus arbitration function ? a built-in bus arbiter arbitrates the bus right to the cpu, dmac, refresh controller, or an external bus master.
section 6 bus controller rev. 3.00 sep 27, 2006 page 124 of 872 rej09b0325-0300 6.1.2 block diagram figure 6.1 shows a block diagram of the bus controller. 7 cs to cs abwcr astcr wcer cscr chip select control signals back breq wait internal address bus area decoder bus control circuit wait-state controller internal data bus legend: abwcr: astcr: wcer: wcr: brcr: cscr: bus width control register access state control register wait state controller enable register wait control register bus release control register chip select control register cpu bus request signal dmac bus request signal refresh controller bus request signal cpu bus acknowledge signal dmac bus acknowledge signal refresh controller bus acknowledge signal internal signals wcr brcr bus arbiter 0 bus mode control signal bus size control signal access state control signal wait request signal internal signals figure 6.1 block diagram of bus controller
section 6 bus controller rev. 3.00 sep 27, 2006 page 125 of 872 rej09b0325-0300 6.1.3 input/output pins table 6.1 summarizes the bus controller?s input/output pins. table 6.1 bus controller pins name abbreviation i/o function chip select 7 to 0 cs 7 to cs 0 output strobe signals selecting areas 7 to 0 address strobe as output strobe signal indicating valid address output on the address bus read rd output strobe signal indicating reading from the external address space high write hwr output strobe signal indicating writing to the external address space, with valid data on the upper data bus (d 15 to d 8 ) low write lwr output strobe signal indicating writing to the external address space, with valid data on the lower data bus (d 7 to d 0 ) wait wait input wait request signal for access to external three-state-access areas bus request breq input request signal for releasing the bus to an external device bus acknowledge back output acknowledge signal indicating the bus is released to an external device
section 6 bus controller rev. 3.00 sep 27, 2006 page 126 of 872 rej09b0325-0300 6.1.4 register configuration table 6.2 summarizes the bus controller?s registers. table 6.2 bus controller registers initial value address * name abbreviation r/w modes 1, 3, 5, 6 modes 2, 4, 7 h'ffec bus width control register abwcr r/w h'ff h'00 h'ffed access state control register astcr r/w h'ff h'ff h'ffee wait control register wcr r/w h'f3 h'f3 h'ffef wait state controller enable register wcer r/w h'ff h'ff h'fff3 bus release control register brcr r/w h'fe h'fe h'ff5f chip select control register cscr r/w h'0f h'0f note: * lower 16 bits of the address. 6.2 register descriptions 6.2.1 bus width control register (abwcr) abwcr is an 8-bit readable/writable register that selects 8-bit or 16-bit access for each area. bit read/write 7 abw7 1 0 r/w 6 abw6 1 0 r/w 5 abw5 1 0 r/w 4 abw4 1 0 r/w 3 abw3 1 0 r/w 0 abw0 1 0 r/w 2 abw2 1 0 r/w 1 abw1 1 0 r/w bits selecting bus width for each area initial value modes 1, 3, 5, 6 modes 2, 4, 7 when abwcr contains h'ff (selecting 8-bit access for all areas), the chip operates in 8-bit bus mode: the upper data bus (d 15 to d 8 ) is valid, and port 4 is an input/output port. when at least one bit is cleared to 0 in abwcr, the chip operates in 16-bit bus mode with a 16-bit data bus (d 15 to d 0 ). in modes 1, 3, 5, and 6 abwcr is initialized to h'ff by a reset and in hardware standby mode. in modes 2, 4, and 7 abwcr is initialized to h'00 by a reset and in hardware standby mode. abwcr is not initialized in software standby mode.
section 6 bus controller rev. 3.00 sep 27, 2006 page 127 of 872 rej09b0325-0300 bits 7 to 0?areas 7 to 0 bus width control (abw7 to abw0): these bits select 8-bit access or 16-bit access to the corresponding address areas. bits 7 to 0: abw7 to abw0 description 0 areas 7 to 0 are 16-bit access areas 1 areas 7 to 0 are 8-bit access areas abwcr specifies the bus width of external memory areas. the bus width of on-chip memory and internal i/o registers is fixed and does not depend on abwcr settings. these settings are therefore meaningless in single-chip mode (mode 7). 6.2.2 access state control register (astcr) astcr is an 8-bit readable/writable register that selects whether each area is accessed in two states or three states. bit initial value read/write 7 ast7 1 r/w 6 ast6 1 r/w 5 ast5 1 r/w 4 ast4 1 r/w 3 ast3 1 r/w 0 ast0 1 r/w 2 ast2 1 r/w 1 ast1 1 r/w bits selecting number of states for access to each area astcr is initialized to h'ff by a reset and in hardware standby mode. it is not initialized in software standby mode. bits 7 to 0?areas 7 to 0 access state control (ast7 to ast0): these bits select whether the corresponding area is accessed in two or three states. bits 7 to 0: ast7 to ast0 description 0 areas 7 to 0 are accessed in two states 1 areas 7 to 0 are accessed in three states (initial value) astcr specifies the number of states in which external areas are accessed. on-chip memory and internal i/o registers are accessed in a fixed number of states that does not depend on astcr settings. these settings are therefore meaningless in single-chip mode (mode 7).
section 6 bus controller rev. 3.00 sep 27, 2006 page 128 of 872 rej09b0325-0300 6.2.3 wait control register (wcr) wcr is an 8-bit readable/writable register that selects the wait mode for the wait-state controller (wsc) and specifies the number of wait states. bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 wms1 0 r/w 0 wc0 1 r/w 2 wms0 0 r/w 1 wc1 1 r/w wait count 1/0 these bits select the number of wait states inserted reserved bits wait mode select 1/0 these bits select the wait mode wcr is initialized to h'f3 by a reset and in hardware standby mode. it is not initialized in software standby mode. bits 7 to 4?reserved: read-only bits, always read as 1. bits 3 and 2?wait mode select 1 and 0 (wms1, wms0): these bits select the wait mode. bit 3: wms1 bit 2: wms0 description 0 0 programmable wait mode (initial value) 1 no wait states inserted by wait-state controller 1 0 pin wait mode 1 1 pin auto-wait mode bits 1 and 0?wait count 1 and 0 (wc1, wc0): these bits select the number of wait states inserted in access to external three-state-access areas. bit 1: wc1 bit 0: wc0 description 0 0 no wait states inserted by wait-state controller 1 1 state inserted 1 0 2 states inserted 1 3 states inserted (initial value)
section 6 bus controller rev. 3.00 sep 27, 2006 page 129 of 872 rej09b0325-0300 6.2.4 wait state controller enable register (wcer) wcer is an 8-bit readable/writable register that enables or disables wait-state control of external three-state-access areas by the wait-state controller. bit initial value read/write 7 wce7 1 r/w 6 wce6 1 r/w 5 wce5 1 r/w 4 wce4 1 r/w 3 wce3 1 r/w 0 wce0 1 r/w 2 wce2 1 r/w 1 wce1 1 r/w wait-state controller enable 7 to 0 these bits enable or disable wait-state control wcer is initialized to h'ff by a reset and in hardware standby mode. it is not initialized in software standby mode. bits 7 to 0?wait-state controller enable 7 to 0 (wce7 to wce0): these bits enable or disable wait-state control of external three-state-access areas. bits 7 to 0: wce7 to wce0 description 0 wait-state control disabled (pin wait mode 0) 1 wait-state control enabled (initial value) since wcer enables or disables wait-state control of external three-state-access areas, these settings are meaningless in single-chip mode (mode 7).
section 6 bus controller rev. 3.00 sep 27, 2006 page 130 of 872 rej09b0325-0300 6.2.5 bus release control register (brcr) brcr is an 8-bit readable/writable register that enables address output on bus lines a 23 to a 21 and enables or disables release of the bus to an external device. bit initial value 7 a23e 1 ? r/w 6 a22e 1 ? r/w 5 a21e 1 ? r/w 4 ? 1 ? ? 3 ? 1 ? ? 0 brle 0 r/w r/w 2 ? 1 ? ? 1 ? 1 ? ? enables or disables release of the bus to an external device reserved bits address 23 to 21 enable these bits enable pa to pa to be used for a to a address output 6 4 21 23 read/ write modes 1, 2, 5, 7 modes 3, 4, 6 brcr is initialized to h'fe by a reset and in hardware standby mode. it is not initialized in software standby mode. bit 7?address 23 enable (a23e): enables pa 4 to be used as the a 23 address output pin. writing 0 in this bit enables a 23 address output from pa 4 . in modes other than 3, 4, and 6 this bit cannot be modified and pa 4 has its ordinary input/output functions. bit 7: a23e description 0pa 4 is the a 23 address output pin 1pa 4 is the pa 4 /tp 4 /tioca 1 input/output pin (initial value) bit 6?address 22 enable (a22e): enables pa 5 to be used as the a 22 address output pin. writing 0 in this bit enables a 22 address output from pa 5 . in modes other than 3, 4, and 6 this bit cannot be modified and pa 5 has its ordinary input/output functions. bit 6: a22e description 0pa 5 is the a 22 address output pin 1pa 5 is the pa 5 /tp 5 /tiocb 1 input/output pin (initial value)
section 6 bus controller rev. 3.00 sep 27, 2006 page 131 of 872 rej09b0325-0300 bit 5?address 21 enable (a21e): enables pa 6 to be used as the a 21 address output pin. writing 0 in this bit enables a 21 address output from pa 6 . in modes other than 3, 4, and 6 this bit cannot be modified and pa 6 has its ordinary input/output functions. bit 5: a21e description 0pa 6 is the a 21 address output pin 1pa 6 is the pa 6 /tp 6 /tioca 2 input/output pin (initial value) bits 4 to 1?reserved: read-only bits, always read as 1. bit 0?bus release enable (brle): enables or disables release of the bus to an external device. bit 0: brle description 0 the bus cannot be released to an external device; breq and back can be used as input/output pins (initial value) 1 the bus can be released to an external device
section 6 bus controller rev. 3.00 sep 27, 2006 page 132 of 872 rej09b0325-0300 6.2.6 chip select control register (cscr) cscr is an 8-bit readable/writable register that enables or disables output of chip select signals ( cs 7 to cs 4 ). if a chip select signal ( cs 7 to cs 4 ) output is selected in this register, the corresponding pin functions as a chip select signal ( cs 7 to cs 4 ) output, this function taking priority over other functions. cscr cannot be modified in single-chip mode. bit initial value read/write 7 cs7e 0 r/w 6 cs6e 0 r/w 5 cs5e 0 r/w 4 cs4e 0 r/w 3 ? 1 ? 0 ? 1 ? 2 ? 1 ? 1 ? 1 ? these bits enable or disable chip select signal output reserved bits cscr is initialized to h'0f by a reset and in hardware standby mode. it is not initialized in software standby mode. bits 7 to 4?chip select 7 to 4 enable (cs7e to cs4e): these bits enable or disable output of the corresponding chip select signal. bit n: csne description 0 output of chip select signal cs n is disabled (initial value) 1 output of chip select signal cs n is enabled note: n = 7 to 4 bits 3 to 0?reserved: read-only bits, always read as 1.
section 6 bus controller rev. 3.00 sep 27, 2006 page 133 of 872 rej09b0325-0300 6.3 operation 6.3.1 area division the external address space is divided into areas 0 to 7. each area has a size of 128 kbytes in the 1-mbyte modes, or 2 mbytes in the 16-mbyte modes. figure 6.2 shows a general view of the memory map. h'00000 area 0 (128 kbytes) area 1 (128 kbytes) area 2 (128 kbytes) area 3 (128 kbytes) area 4 (128 kbytes) area 5 (128 kbytes) area 6 (128 kbytes) area 7 (128 kbytes) on-chip ram * 1 * 2 external address space * 3 internal i/o registers * 1 a. notes: the on-chip rom, on-chip ram, and internal i/o registers have a fixed bus width and are accessed in a fixed number of states. when the rame bit is cleared to 0 in syscr, this area conforms to the specifications of area 7. this external address area conforms to the specifications of area 7. 1. 2. 3. h'1ffff h'20000 h'3ffff h'40000 h'5ffff h'60000 h'7ffff h'80000 h'9ffff h'a0000 h'bffff h'c0000 h'dffff h'e0000 h'fffff b. h'000000 area 0 (2 mbytes) area 1 (2 mbytes) area 2 (2 mbytes) area 3 (2 mbytes) area 4 (2 mbytes) area 5 (2 mbytes) area 6 (2 mbytes) area 7 (2 mbytes) on-chip ram * 1 * 2 external address space * 3 internal i/o registers * 1 h'1fffff h'200000 h'3fffff h'400000 h'5fffff h'600000 h'7fffff h'800000 h'9fffff h'a00000 h'bfffff h'c00000 h'dfffff h'e00000 h'ffffff h'000000 h'1fffff h'200000 h'3fffff h'400000 h'5fffff h'600000 h'7fffff h'800000 h'9fffff h'a00000 h'bfffff h'c00000 h'dfffff h'e00000 h'ffffff h'00000 area 1 (128 kbytes) area 2 (128 kbytes) area 3 (128 kbytes) area 4 (128 kbytes) area 5 (128 kbytes) area 6 (128 kbytes) h'1ffff h'20000 h'3ffff h'40000 h'5ffff h'60000 h'7ffff h'80000 h'9ffff h'a0000 h'bffff h'c0000 h'dffff h'e0000 h'fffff 1-mbyte modes with on-chip rom disabled (modes 1 and 2) 16-mbyte modes with on-chip rom disabled (modes 3 and 4) c. 1-mbyte mode with on-chip rom enabled (mode 5) area 7 (128 kbytes) on-chip ram * 1 * 2 external address space * 3 internal i/o registers * 1 on-chip rom * 1 area 0 (128 kbytes) area 1 (2 mbytes) area 2 (2 mbytes) area 3 (2 mbytes) area 4 (2 mbytes) area 5 (2 mbytes) area 6 (2 mbytes) d. 16-mbyte mode with on-chip rom enabled (mode 6) area 7 (2 mbytes) on-chip ram * 1 * 2 external address space * 3 internal i/o registers * 1 on-chip rom * 1 area 0 (2 mbytes) figure 6.2 access area map for modes 1 to 6
section 6 bus controller rev. 3.00 sep 27, 2006 page 134 of 872 rej09b0325-0300 chip select signals ( cs 7 to cs 0 ) can be output for areas 7 to 0. the bus specifications for each area can be selected in abwcr, astcr, wcer, and wcr as shown in table 6.3. table 6.3 bus specifications abwcr astcr wcer wcr bus specifications abwn astn wcen wms1 wms0 bus width access states wait mode 00???162disabled 1 0 ? ? 16 3 pin wait mode 0 1 0 0 16 3 programmable wait mode 1163disabled 1 0 16 3 pin wait mode 1 1 16 3 pin auto-wait mode 1 0 ? ? ? 8 2 disabled 1 0 ? ? 8 3 pin wait mode 0 1 0 0 8 3 programmable wait mode 1 8 3 disabled 1 0 8 3 pin wait mode 1 1 8 3 pin auto-wait mode note: n = 0 to 7
section 6 bus controller rev. 3.00 sep 27, 2006 page 135 of 872 rej09b0325-0300 6.3.2 chip select signals for each of areas 7 to 0, the h8/3048b group can output a chip select signal ( cs 7 to cs 0 ) that goes low to indicate when the area is selected. figure 6.3 shows the output timing of a cs n signal (n = 0 to 7). output of cs cs cs cs 3 to cs cs cs cs 0 : output of cs 3 to cs 0 is enabled or disabled in the data direction register (ddr) of the corresponding port. in the expanded modes with on-chip rom disabled, a reset leaves pin cs 0 in the output state and pins cs 3 to cs 1 in the input state. to output chip select signals cs 3 to cs 1 , the corresponding ddr bits must be set to 1. in the expanded modes with on-chip rom enabled, a reset leaves pins cs 3 to cs 0 in the input state. to output chip select signals cs 3 to cs 0 , the corresponding ddr bits must be set to 1. for details see section 9, i/o ports. output of cs cs cs cs 7 to cs cs cs cs 4 : output of cs 7 to cs 4 is enabled or disabled in the chip select control register (cscr). a reset leaves pins cs 7 to cs 4 in the input state. to output chip select signals cs 7 to cs 4 , the corresponding cscr bits must be set to 1. for details see section 9, i/o ports. address bus n external address in area n cs figure 6.3 cs cs cs cs n output timing (n = 7 to 0) when the on-chip rom, on-chip ram, and internal i/o registers are accessed, cs 7 and cs 0 remain high. the cs n signals are decoded from the address signals. they can be used as chip select signals for sram and other devices.
section 6 bus controller rev. 3.00 sep 27, 2006 page 136 of 872 rej09b0325-0300 6.3.3 data bus the h8/3048b group allows either 8-bit access or 16-bit access to be designated for each of areas 7 to 0. an 8-bit-access area uses the upper data bus (d 15 to d 8 ). a 16-bit-access area uses both the upper data bus (d 15 to d 8 ) and lower data bus (d 7 to d 0 ). in read access the rd signal applies without distinction to both the upper and lower data bus. in write access the hwr signal applies to the upper data bus, and the lwr signal applies to the lower data bus. table 6.4 indicates how the two parts of the data bus are used under different access conditions. table 6.4 access conditions and data bus usage area access size read/ write address valid strobe upper data bus (d 15 to d 8 ) lower data bus (d 7 to d 0 ) ? read ? rd valid invalid 8-bit-access area write ? hwr undetermined data byte read even rd valid invalid 16-bit-access area odd invalid valid write even hwr valid undetermined data odd lwr undetermined data valid word read ? rd valid valid write ? hwr , lwr valid valid note: undetermined data means that unpredictable data is output. invalid means that the bus is in the input state and the input is ignored.
section 6 bus controller rev. 3.00 sep 27, 2006 page 137 of 872 rej09b0325-0300 6.3.4 bus control signal timing 8-bit, three-state-access areas figure 6.4 shows the timing of bus control signals for an 8-bit, three-state-access area. the upper address bus (d 15 to d 8 ) is used to access these areas. the lwr pin is always high. wait states can be inserted. cs as rd d to d d to d hwr lwr d to d d to d n 15 8 7 0 15 8 7 0 t 1 t 2 t 3 read access write access bus cycle external address in area n valid invalid high valid undetermined data note: n = 7 to 0 figure 6.4 bus control signal timing for 8-bit, three-state-access area
section 6 bus controller rev. 3.00 sep 27, 2006 page 138 of 872 rej09b0325-0300 8-bit, two-state-access areas figure 6.5 shows the timing of bus control signals for an 8-bit, two-state-access area. the upper address bus (d 15 to d 8 ) is used to access these areas. the lwr pin is always high. wait states cannot be inserted. cs n as rd hwr lwr figure 6.5 bus control signal timing for 8-bit, two-state-access area
section 6 bus controller rev. 3.00 sep 27, 2006 page 139 of 872 rej09b0325-0300 16-bit, three-state-access areas figures 6.6 to 6.8 show the timing of bus control signals for a 16-bit, three-state-access area. in these areas, the upper address bus (d 15 to d 8 ) is used to access even addresses and the lower address bus (d 7 to d 0 ) is used to access odd addresses. wait states can be inserted. as rd d to d d to d hwr lwr d to d d to d n 15 8 7 0 15 8 7 0 t 1 t 2 t 3 read access write access bus cycle even external address in area n valid invalid valid undetermined data high note: n = 7 to 0 figure 6.6 bus control signal timing for 16-bit, three-state-access area (1) (byte access to even address)
section 6 bus controller rev. 3.00 sep 27, 2006 page 140 of 872 rej09b0325-0300 as rd d to d d to d hwr lwr d to d d to d n 15 8 7 0 15 8 7 0 t 1 t 2 t 3 read access write access bus cycle odd external address in area n invalid valid undetermined data valid high note: n = 7 to 0 figure 6.7 bus control signal timing for 16-bit, three-state-access area (2) (byte access to odd address)
section 6 bus controller rev. 3.00 sep 27, 2006 page 141 of 872 rej09b0325-0300 cs as rd d to d d to d hwr lwr d to d d to d n 15 8 7 0 15 8 7 0 t 1 t 2 t 3 read access bus cycle external address in area n valid valid valid valid write access note: n = 7 to 0 figure 6.8 bus control signal timing for 16-bit, three-state-access area (3) (word access)
section 6 bus controller rev. 3.00 sep 27, 2006 page 142 of 872 rej09b0325-0300 16-bit, two-state-access areas figures 6.9 to 6.11 show the timing of bus control signals for a 16-bit, two-state-access area. in these areas, the upper address bus (d 15 to d 8 ) is used to access even addresses and the lower address bus (d 7 to d 0 ) is used to access odd addresses. wait states cannot be inserted. cs as rd d to d d to d hwr lwr d to d d to d 15 8 7 0 15 8 7 0 n t 1 t 2 read access write access valid undetermined data high valid invalid bus cycle even external address in area n note: n = 7 to 0 figure 6.9 bus control signal timing for 16-bit, two-state-access area (1) (byte access to even address)
section 6 bus controller rev. 3.00 sep 27, 2006 page 143 of 872 rej09b0325-0300 cs n as rd hwr lwr figure 6.10 bus control signal timing for 16-bit, two-state-access area (2) (byte access to odd address)
section 6 bus controller rev. 3.00 sep 27, 2006 page 144 of 872 rej09b0325-0300 cs n as rd hwr lwr d to d d to d d to d d to d 15 8 7 0 15 8 7 0 t 1 t 2 read access write access valid valid valid valid bus cycle external address in area n note: n = 7 to 0 figure 6.11 bus control signal timing for 16-bit, two-state-access area (3) (word access)
section 6 bus controller rev. 3.00 sep 27, 2006 page 145 of 872 rej09b0325-0300 6.3.5 wait modes four wait modes can be selected as shown in table 6.5. table 6.5 wait mode selection astcr wcer wcr astn bit wcen bit wms1 bit wms0 bit wsc control wait mode 0 ??? disabled no wait states 10 ?? disabled pin wait mode 0 1 0 0 enabled programmable wait mode 1 enabled no wait states 1 0 enabled pin wait mode 1 1 enabled pin auto-wait mode note: n = 7 to 0 wait mode in areas where wait-state controller is disabled external three-state access areas in which the wait-state controller is disabled (astn = 1, wcen = 0) operate in pin wait mode 0. the other wait modes are unavailable. the settings of bits wms1 and wms0 are ignored in these areas. pin wait mode 0: wait states can only be inserted by wait pin control. during access to an external three-state-access area, if the wait pin is low at the fall of the system clock ( wait pin remains low, wait states continue to be inserted until the wait signal goes high. figure 6.12 shows the timing.
section 6 bus controller rev. 3.00 sep 27, 2006 page 146 of 872 rej09b0325-0300 as rd hwr data bus , lwr t 1 t 2 t w t w t 3 inserted by signal write data ** read data read access write access external address wait wait pin note: * arrows indicate time of sampling of the pin. wait * figure 6.12 pin wait mode 0 wait modes in areas where wait-state controller is enabled external three-state access areas in which the wait-state controller is enabled (astn = 1, wcen = 1) can operate in pin wait mode 1, pin auto-wait mode, or programmable wait mode, as selected by bits wms1 and wms0. bits wms1 and wms0 apply to all areas, so all areas in which the wait- state controller is enabled operate in the same wait mode. pin wait mode 1: in all accesses to external three-state-access areas, the number of wait states (t w ) selected by bits wc1 and wc0 are inserted. if the wait pin is low at the fall of the system clock ( wait pin remains low, wait states continue to be inserted until the wait signal goes high. pin wait mode 1 is useful for inserting four or more wait states, or for inserting different numbers of wait states for different external devices. if the wait count is 0, this mode operates in the same way as pin wait mode 0.
section 6 bus controller rev. 3.00 sep 27, 2006 page 147 of 872 rej09b0325-0300 figure 6.13 shows the timing when the wait count is 1 (wc1 = 0, wc0 = 1) and one additional wait state is inserted by wait input. address bus data bus as rd hwr , lwr t 1 t 2 t w t w t 3 write data * read data * read access write access note: * arrows indicate time of sampling of the pin. wait wait pin data bus external address write data inserted by wait count inserted by signal wait figure 6.13 pin wait mode 1
section 6 bus controller rev. 3.00 sep 27, 2006 page 148 of 872 rej09b0325-0300 pin auto-wait mode: if the wait pin is low, the number of wait states (t w ) selected by bits wc1 and wc0 are inserted. in pin auto-wait mode, if the wait pin is low at the fall of the system clock ( wait pin remains low. pin auto-wait mode can be used for an easy interface to low-speed memory, simply by routing the chip select signal to the wait pin. figure 6.14 shows the timing when the wait count is 1. as rd hwr data bus , lwr t 1 t 2 t 3 t 1 t 2 t w t 3 * * read data read data write data write data read access write access note: * arrows indicate time of sampling of the pin. wait external address external address wait figure 6.14 pin auto-wait mode
section 6 bus controller rev. 3.00 sep 27, 2006 page 149 of 872 rej09b0325-0300 programmable wait mode: the number of wait states (t w ) selected by bits wc1 and wc0 are inserted in all accesses to external three-state-access areas. figure 6.15 shows the timing when the wait count is 1 (wc1 = 0, wc0 = 1). t 1 t 2 t w t 3 as rd hwr , data bus data bus external address read data write data read access write access lwr figure 6.15 programmable wait mode
section 6 bus controller rev. 3.00 sep 27, 2006 page 150 of 872 rej09b0325-0300 example of wait state control settings a reset initializes astcr and wcer to h'ff and wcr to h'f3, selecting programmable wait mode and three wait states for all areas. software can select other wait modes for individual areas by modifying the astcr, wcer, and wcr settings. figure 6.16 shows an example of wait mode settings. 76543210 0 0 ? ? ? ? figure 6.16 wait mode settings (example)
section 6 bus controller rev. 3.00 sep 27, 2006 page 151 of 872 rej09b0325-0300 6.3.6 interconnections with memory (example) for each area, the bus controller can select two- or three-state access and an 8- or 16-bit data bus width. in three-state-access areas, wait states can be inserted in a variety of modes, simplifying the connection of both high-speed and low-speed devices. figure 6.18 shows an example of interconnections between the h8/3048b group and memory. figure 6.17 shows a memory map for this example. a 256-kword figure 6.17 memory map (example)
section 6 bus controller rev. 3.00 sep 27, 2006 page 152 of 872 rej09b0325-0300 eprom a to a i/o to i/o i/o to i/o ce oe 18 15 7 0 8 0 a to a 19 1 sram1 (even addresses) a to a i/o to i/o cs oe we 14 7 0 0 a to a 15 1 sram2 (odd addresses) a to a i/o to i/o cs oe we 14 7 0 0 a to a 15 1 sram3 a to a i/o to i/o cs oe we 14 7 0 0 a to a 14 0 h8/3048b group cs cs cs 0 1 2 wait rd hwr lwr a to a 23 0 d to d d to d 15 8 7 0 figure 6.18 interconnections with memory (example)
section 6 bus controller rev. 3.00 sep 27, 2006 page 153 of 872 rej09b0325-0300 6.3.7 bus arbiter operation the bus controller has a built-in bus arbiter that arbitrates between different bus masters. there are four bus masters: the cpu, dma controller (dmac), refresh controller, and an external bus master. when a bus master has the bus right it can carry out read, write, or refresh access. each bus master uses a bus request signal to request the bus right. at fixed times the bus arbiter determines priority and uses a bus acknowledge signal to grant the bus to a bus master, which can then operate using the bus. the bus arbiter checks whether the bus request signal from a bus master is active or inactive, and returns an acknowledge signal to the bus master if the bus request signal is active. when two or more bus masters request the bus, the highest-priority bus master receives an acknowledge signal. the bus master that receives an acknowledge signal can continue to use the bus until the acknowledge signal is deactivated. the bus master priority order is: (high) external bus master > refresh controller > dmac > cpu (low) the bus arbiter samples the bus request signals and determines priority at all times, but it does not always grant the bus immediately, even when it receives a bus request from a bus master with higher priority than the current bus master. each bus master has certain times at which it can release the bus to a higher-priority bus master. cpu the cpu is the lowest-priority bus master. if the dmac, refresh controller, or an external bus master requests the bus while the cpu has the bus right, the bus arbiter transfers the bus right to the bus master that requested it. the bus right is transferred at the following times: ? the bus right is transferred at the boundary of a bus cycle. if word data is accessed by two consecutive byte accesses, however, the bus right is not transferred between the two byte accesses. ? if another bus master requests the bus while the cpu is performing internal operations, such as executing a multiply or divide instruction, the bus right is transferred immediately. the cpu continues its internal operations. ? if another bus master requests the bus while the cpu is in sleep mode, the bus right is transferred immediately.
section 6 bus controller rev. 3.00 sep 27, 2006 page 154 of 872 rej09b0325-0300 dmac when the dmac receives an activation request, it requests the bus right from the bus arbiter. if the dmac is bus master and the refresh controller or an external bus master requests the bus, the bus arbiter transfers the bus right from the dmac to the bus master that requested the bus. the bus right is transferred at the following times. the bus right is transferred when the dmac finishes transferring 1 byte or 1 word. a dmac transfer cycle consists of a read cycle and a write cycle. the bus right is not transferred between the read cycle and the write cycle. there is a priority order among the dmac channels. for details see section 8.4.9, dmac multiple-channel operation. refresh controller when a refresh cycle is requested, the refresh controller requests the bus right from the bus arbiter. when the refresh cycle is completed, the refresh controller releases the bus. for details see section 7, refresh controller. external bus master when the brle bit is set to 1 in brcr, the bus can be released to an external bus master. the external bus master has highest priority, and requests the bus right from the bus arbiter by driving the breq signal low. once the external bus master gets the bus, it keeps the bus right until the breq signal goes high. while the bus is released to an external bus master, the h8/3048b group holds the address bus and data bus control signals ( as , rd , hwr , and lwr ) in the high- impedance state, holds the chip select signals high ( cs n : n = 7 to 0), and holds the back pin in the low output state. the bus arbiter samples the breq pin at the rise of the system clock ( breq is low, the bus is released to the external bus master at the appropriate opportunity. the breq signal should be held low until the back signal goes low. when the breq pin is high in two consecutive samples, the back signal is driven high to end the bus-release cycle.
section 6 bus controller rev. 3.00 sep 27, 2006 page 155 of 872 rej09b0325-0300 figure 6.19 shows the timing when the bus right is requested by an external bus master during a read cycle in a two-state-access area. there is a minimum interval of two states from when the breq signal goes low until the bus is released. as hwr breq back rd , lwr , t 1 t 2 address 2 1 3456 high cpu cycles external bus released cpu cycles minimum 2 cycles high-impedance high-impedance high-impedance high-impedance 1 2 3 4, 5 6 low signal is sampled at rise of t state. signal goes low at end of cpu read cycle, releasing bus right to external bus master. pin continues to be sampled while bus is released to external bus master. high signal is sampled twice consecutively. signal goes high, ending bus-release cycle. breq breq breq back back 1 address bus cs n high level note: n = 7 to 0 figure 6.19 external-bus-released state (two-state-access area, during read cycle)
section 6 bus controller rev. 3.00 sep 27, 2006 page 156 of 872 rej09b0325-0300 6.4 usage notes 6.4.1 connection to dynamic ram and pseudo-static ram a different bus control signal timing applies when dynamic ram or pseudo-static ram is connected to area 3. for details see section 7, refresh controller. 6.4.2 register write timing abwcr, astcr, and wcer write timing data written to abwcr, astcr, or wcer takes effect starting from the next bus cycle. figure 6.20 shows the timing when an instruction fetched from area 0 changes area 0 from three-state access to two-state access. figure 6.20 astcr write timing
section 6 bus controller rev. 3.00 sep 27, 2006 page 157 of 872 rej09b0325-0300 ddr write timing data written to a data direction register (ddr) to change a cs n pin from cs n output to generic input, or vice versa, takes effect starting from the t 3 state of the ddr write cycle. figure 6.21 shows the timing when the cs 1 pin is changed from generic input to cs 1 output. cs 1 t 1 t 2 t 3 p8ddr address high-impedance address bus figure 6.21 ddr write timing brcr write timing data written to switch between a 23 , a 22 , or a 21 output and generic input or output takes effect starting from the t 3 state of the brcr write cycle. figure 6.22 shows the timing when a pin is changed from generic input to a 23 , a 22 , or a 21 output. figure 6.22 brcr write timing
section 6 bus controller rev. 3.00 sep 27, 2006 page 158 of 872 rej09b0325-0300 6.4.3 breq breq breq breq input timing after driving the breq pin low, hold it low until back goes low. if breq returns to the high level before back goes low, the bus arbiter may operate incorrectly. to terminate the external-bus-released state, hold the breq signal high for at least three states. if breq is high for too short an interval, the bus arbiter may operate incorrectly. 6.4.4 transition to software standby mode if contention occurs between a transition to software standby mode and a bus request from an external bus master, the bus may be released for one state just before the transition to software standby mode (see figure 6.23). when using software standby mode, clear the brle bit to 0 in brcr before executing the sleep instruction. breq back bus-released state software standby mode figure 6.23 contention between bus-released state and software standby mode
section 7 refresh controller rev. 3.00 sep 27, 2006 page 159 of 872 rej09b0325-0300 section 7 refresh controller 7.1 overview the h8/3048b group has an on-chip refresh controller that enables direct connection of 16-bit- wide dram or pseudo-static ram (psram). dram or pseudo-static ram can be directly connected to area 3 of the external address space. a maximum 128 kbytes can be connected in modes 1, 2, and 5 (1-mbyte modes). a maximum 2 mbytes can be connected in modes 3, 4, and 6 (16-mbyte modes). systems that do not need to refresh dram or pseudo-static ram can use the refresh controller as an 8-bit interval timer. when the refresh controller is not used, it can be independently halted to conserve power. for details see section 20.6, module standby function. 7.1.1 features the refresh controller can be used for one of three functions: dram refresh control, pseudo-static ram refresh control, or 8-bit interval timing. features of the refresh controller are listed below. features as a dram refresh controller: ? enables direct connection of 16-bit-wide dram ? selection of 2 cas or 2 we mode ? selection of 8-bit or 9-bit column address multiplexing for dram address input examples: ? 1-mbit dram: 8-bit row address 8-bit column address ? 4-mbit dram: 9-bit row address 9-bit column address ? 4-mbit dram: 10-bit row address 8-bit column address ? cas -before- ras refresh control ? software-selectable refresh interval ? software-selectable self-refresh mode ? wait states can be inserted
section 7 refresh controller rev. 3.00 sep 27, 2006 page 160 of 872 rej09b0325-0300 features as a pseudo-static ram refresh controller: ? rfsh signal output for refresh control ? software-selectable refresh interval ? software-selectable self-refresh mode ? wait states can be inserted features as an interval timer: ? refresh timer counter (rtcnt) can be used as an 8-bit up-counter ? selection of seven counter clock sources: /2, /8, /32, /128, /512, /2048, /4096 ? interrupts can be generated by compare match between rtcnt and the refresh time constant register (rtcor)
section 7 refresh controller rev. 3.00 sep 27, 2006 page 161 of 872 rej09b0325-0300 7.1.2 block diagram figure 7.1 shows a block diagram of the refresh controller. /2, /8, /32, /128, /512, /2048, /4096 rtcnt rtcor rtmcsr rfshcr legend: rtcnt: rtcor: rtmcsr: rfshcr: refresh signal clock selector comparator cmi interrupt bus interface internal data bus module data bus refresh timer counter refresh time constant register refresh timer control/status register refresh control register control logic figure 7.1 block diagram of refresh controller
section 7 refresh controller rev. 3.00 sep 27, 2006 page 162 of 872 rej09b0325-0300 7.1.3 input/output pins table 7.1 summarizes the refresh controller?s input/output pins. table 7.1 refresh controller pins signal pin name abbr. i/o function rfsh refresh rfsh output goes low during refresh cycles; used to refresh dram and psram hwr upper write/upper column address strobe uw/ucas output connects to the uw pin of 2 we dram or u cas pin of 2 cas dram lwr lower write/lower column address strobe lw/lcas output connects to the lw pin of 2 we dram or lcas pin of 2 ca s dram rd column address strobe/ write enable cas/we output connects to the cas pin of 2 we dram or we pin of 2 cas dram cs 3 row address strobe ras output connects to the ras pin of dram 7.1.4 register configuration table 7.2 summarizes the refresh controller?s registers. table 7.2 refresh controller registers address * name abbreviation r/w initial value h'ffac refresh control register rfshcr r/w h'02 h'ffad refresh timer control/status register rtmcsr r/w h'07 h'ffae refresh timer counter rtcnt r/w h'00 h'ffaf refresh time constant register rtcor r/w h'ff note: * lower 16 bits of the address.
section 7 refresh controller rev. 3.00 sep 27, 2006 page 163 of 872 rej09b0325-0300 7.2 register descriptions 7.2.1 refresh control register (rfshcr) rfshcr is an 8-bit readable/writable register that selects the operating mode of the refresh controller. bit initial value read/write 7 srfmd 0 r/w 6 psrame 0 r/w 5 drame 0 r/w 4 cas/we 0 r/w 3 m9/m8 0 r/w 0 rcyce 0 r/w 2 rfshe 0 r/w 1 ? 1 ? selects self-refresh mode psram enable and dram enable these bits enable or disable connection of pseudo-static ram and dram strobe mode select selects 2 cas or 2 we strobing of dram address multiplex mode select selects the number of column address bits refresh pin enable enables refresh signal output from the refresh pin refresh cycle enable enables or disables insertion of refresh cycles reserved bit rfshcr is initialized to h'02 by a reset and in hardware standby mode.
section 7 refresh controller rev. 3.00 sep 27, 2006 page 164 of 872 rej09b0325-0300 bit 7?self-refresh mode (srfmd): specifies dram or pseudo-static ram self-refresh during software standby mode. when psrame = 1 and drame = 0, after the srfmd bit is set to 1, pseudo-static ram can be self-refreshed when the h8/3048b group enters software standby mode. when psrame = 0 and drame = 1, after the srfmd bit is set to 1, dram can be self- refreshed when the h8/3048b group enters software standby mode. in either case, the normal access state resumes on exit from software standby mode. bit 7: srfmd description 0 dram or psram self-refresh is disabled in software standby mode (initial value) 1 dram or psram self-refresh is enabled in software standby mode bit 6?psram enable (psrame) and bit 5?dram enable (drame): these bits enable or disable connection of pseudo-static ram and dram to area 3 of the external address space. when dram or pseudo-static ram is connected, the bus cycle and refresh cycle of area 3 consist of three states, regardless of the setting in the access state control register (astcr). if ast3 = 0 in astcr, wait states cannot be inserted. when the psrame or drame bit is set to 1, bits 0, 2, 3, and 4 in rfshcr and registers rtmcsr, rtcnt, and rtcor are write-disabled, except that the cmf flag in rtmcsr can be cleared by writing 0. bit 6: psrame bit 5: drame description 0 0 can be used as an interval timer (initial value) (dram and psram cannot be directly connected) 1 dram can be directly connected 1 0 psram can be directly connected 1 illegal setting bit 4?strobe mode select (cas/ we we we we ): selects 2 cas or 2 we mode. the setting of this bit is valid when psrame = 0 and drame = 1. this bit is write-disabled when the psrame or drame bit is set to 1. bit 4: cas/ we we we we description 02 we mode (initial value) 12 cas mode
section 7 refresh controller rev. 3.00 sep 27, 2006 page 165 of 872 rej09b0325-0300 bit 3?address multiplex mode select (m9/ m8 m8 m8 m8 ): selects 8-bit or 9-bit column addressing. the setting of this bit is valid when psrame = 0 and drame = 1. this bit is write-disabled when the psrame or drame bit is set to 1. bit 3: m9/ m8 m8 m8 m8 description 0 8-bit column address mode (initial value) 1 9-bit column address mode bit 2?refresh pin enable (rfshe): enables or disables refresh signal output from the rfsh pin. this bit is write-disabled when the psrame or drame bit is set to 1. bit 2: rfshe description 0 refresh signal output at the rfsh pin is disabled (the rfsh pin can be used as a generic input/output port) (initial value) 1 refresh signal output at the rfsh pin is enabled bit 1?reserved: read-only bit, always read as 1. bit 0?refresh cycle enable (rcyce): enables or disables insertion of refresh cycles. the setting of this bit is valid when psrame = 1 or drame = 1. when psrame = 0 and drame = 0, refresh cycles are not inserted regardless of the setting of this bit. bit 0: rcyce description 0 refresh cycles are disabled (initial value) 1 refresh cycles are enabled for area 3
section 7 refresh controller rev. 3.00 sep 27, 2006 page 166 of 872 rej09b0325-0300 7.2.2 refresh timer control/status register (rtmcsr) rtmcsr is an 8-bit readable/writable register that selects the clock source for rtcnt. it also enables or disables interrupt requests when the refresh controller is used as an interval timer. bit initial value read/write 7 cmf 0 r/(w) 6 cmie 0 r/w 5 cks2 0 r/w 4 cks1 0 r/w 3 cks0 0 r/w 0 ? 1 ? 2 ? 1 ? 1 ? 1 ? status flag indicating that rtcnt has matched rtcor reserved bits clock select 2 to 0 these bits select an internal clock source for input to rtcnt note: * only 0 can be written, to clear the flag. * compare match interrupt enable enables or disables the cmi interrupt requested by cmf bits 7 and 6 are initialized by a reset and in standby mode. bits 5 to 3 are initialized by a reset and in hardware standby mode, but retain their previous values on transition to software standby mode. bit 7?compare match flag (cmf): this status flag indicates that the rtcnt and rtcor values have matched. bit 7: cmf description 0 [clearing condition] cleared by reading cmf when cmf = 1, then writing 0 in cmf 1 [setting condition] when rtcnt = rtcor
section 7 refresh controller rev. 3.00 sep 27, 2006 page 167 of 872 rej09b0325-0300 bit 6?compare match interrupt enable (cmie): enables or disables the cmi interrupt requested when the cmf flag is set to 1 in rtmcsr. the cmie bit is always cleared to 0 when psrame = 1 or drame = 1. bit 6: cmie description 0 the cmi interrupt requested by cmf is disabled (initial value) 1 the cmi interrupt requested by cmf is enabled bits 5 to 3?clock select 2 to 0 (cks2 to cks0): these bits select an internal clock source for input to rtcnt. when used for refresh control, the refresh controller outputs a refresh request at periodic intervals determined by compare match between rtcnt and rtcor. when used as an interval timer, the refresh controller generates cmi interrupts at periodic intervals determined by compare match. these bits are write-disabled when the psrame bit or drame bit is set to 1. bit 5: cks2 bit 4: cks1 bit 3: cks0 description 0 0 0 clock input is disabled (initial value) 1 /2 clock source 10 /8 clock source 1 /32 clock source 100 /128 clock source 1 /512 clock source 10 /2048 clock source 1 /4096 clock source bits 2 to 0?reserved: read-only bits, always read as 1.
section 7 refresh controller rev. 3.00 sep 27, 2006 page 168 of 872 rej09b0325-0300 7.2.3 refresh timer counter (rtcnt) rtcnt is an 8-bit readable/writable up-counter. bit initial value read/write 7 0 r/w 6 0 r/w 5 0 r/w 4 0 r/w 3 0 r/w 0 0 r/w 2 0 r/w 1 0 r/w rtcnt is an up-counter that is incremented by an internal clock selected by bits cks2 to cks0 in rtmcsr. when rtcnt matches rtcor (compare match), the cmf flag is set to 1 and rtcnt is cleared to h'00. rtcnt is write-disabled when the psrame bit or drame bit is set to 1. rtcnt is initialized to h'00 by a reset and in standby mode. 7.2.4 refresh time constant register (rtcor) rtcor is an 8-bit readable/writable register that determines the interval at which rtcnt is compare matched. bit initial value read/write 7 1 r/w 6 1 r/w 5 1 r/w 4 1 r/w 3 1 r/w 0 1 r/w 2 1 r/w 1 1 r/w rtcor and rtcnt are constantly compared. when their values match, the cmf flag is set to 1 in rtmcsr, and rtcnt is simultaneously cleared to h'00. rtcor is write-disabled when the psrame bit or drame bit is set to 1. rtcor is initialized to h'ff by a reset and in hardware standby mode. in software standby mode it retains its previous value.
section 7 refresh controller rev. 3.00 sep 27, 2006 page 169 of 872 rej09b0325-0300 7.3 operation 7.3.1 overview one of three functions can be selected for the h8/3048b group refresh controller: interfacing to dram connected to area 3, interfacing to pseudo-static ram connected to area 3, or interval timing. table 7.3 summarizes the register settings when these three functions are used. table 7.3 refresh controller settings usage register settings dram interface psram interface interval timer rfshcr srfmd selects self-refresh mode selects self-refresh mode cleared to 0 psrame cleared to 0 set to 1 cleared to 0 drame set to 1 cleared to 0 cleared to 0 cas/ we selects 2 cas or 2 we mode ?? m9/ m8 selects column addressing mode ?? rfshe selects rfsh signal output selects rfsh signal output cleared to 0 rcyce selects insertion of refresh cycles selects insertion of refresh cycles ? rtcor rtmcsr cks2 to cks0 refresh interval setting refresh interval setting interrupt interval setting cmf set to 1 when rtcnt = rtcor set to 1 when rtcnt = rtcor set to 1 when rtcnt = rtcor cmie cleared to 0 cleared to 0 enables or disables interrupt requests p8ddr p8 1 ddr set to 1 ( cs 3 output) set to 1 ( cs 3 output) set to 0 or 1 abwcr abw3 cleared to 0 ? ?
section 7 refresh controller rev. 3.00 sep 27, 2006 page 170 of 872 rej09b0325-0300 dram interface to set up area 3 for connection to 16-bit-wide dram, initialize rtcor, rtmcsr, and rfshcr in that order, clearing bit psrame to 0 and setting bit drame to 1. set bit p8 1 ddr to 1 in the port 8 data direction register (p8ddr) to enable cs 3 output. in abwcr, make area 3 a 16-bit-access area. pseudo-static ram interface to set up area 3 for connection to pseudo-static ram, initialize rtcor, rtmcsr, and rfshcr in that order, setting bit psrame to 1 and clearing bit drame to 0. set bit p8 1 ddr to 1 in p8ddr to enable cs 3 output. interval timer when psrame = 0 and drame = 0, the refresh controller operates as an interval timer. after setting rtcor, select an input clock in rtmcsr and set the cmie bit to 1. cmi interrupts will be requested at compare match intervals determined by rtcor and bits cks2 to cks0 in rtmcsr. when setting rtcor, rtmcsr, and rfshcr, make sure that psrame = 0 and drame = 0. writing is disabled when either of these bits is set to 1.
section 7 refresh controller rev. 3.00 sep 27, 2006 page 171 of 872 rej09b0325-0300 7.3.2 dram refresh control refresh request interval and refresh cycle execution the refresh request interval is determined by the settings of rtcor and bits cks2 to cks0 in rtmcsr. figure 7.2 illustrates the refresh request interval. rtcor h'00 rtcnt refresh request figure 7.2 refresh request interval (rcyce = 1) refresh requests are generated at regular intervals as shown in figure 7.2, but the refresh cycle is not actually executed until the refresh controller gets the bus right. table 7.4 summarizes the relationship among area 3 settings, dram read/write cycles, and refresh cycles. table 7.4 area 3 settings, dram access cycles, and refresh cycles area 3 settings read/write cycle by cpu or dmac refresh cycle 2-state-access area (ast3 = 0) ? 3 states ? wait states cannot be inserted ? 3 states ? wait states cannot be inserted 3-state-access area (ast3 = 1) ? 3 states ? wait states can be inserted ? 3 states ? wait states can be inserted to insert refresh cycles, set the rcyce bit to 1 in rfshcr. figure 7.3 shows the state transitions for execution of refresh cycles. when the first refresh request occurs after exit from the reset state or standby mode, the refresh controller does not execute a refresh cycle, but goes into the refresh request pending state. note this point when using a dram that requires a refresh cycle for initialization.
section 7 refresh controller rev. 3.00 sep 27, 2006 page 172 of 872 rej09b0325-0300 when a refresh request occurs in the refresh request pending state, the refresh controller acquires the bus right, then executes a refresh cycle. if another refresh request occurs during execution of the refresh cycle, it is ignored. refresh request * refresh request * exit from reset or standby mode refresh request pending state requesting bus right executing refresh cycle refresh request refresh request bus granted end of refresh cycle note: a refresh request is ignored if it occurs while the refresh controller is requesting the bus right or executing a refresh cycle. * * figure 7.3 state transitions for refresh cycle execution address multiplexing address multiplexing depends on the setting of the m9/ m8 bit in rfshcr, as described in table 7.5. figure 7.4 shows the address output timing. address output is multiplexed only in area 3.
section 7 refresh controller rev. 3.00 sep 27, 2006 page 173 of 872 rej09b0325-0300 table 7.5 address multiplexing address pins a 23 to a 10 a 9 a 8 a 7 a 6 a 5 a 4 a 3 a 2 a 1 a 0 address signals during row address output a 23 to a 10 a 9 a 8 a 7 a 6 a 5 a 4 a 3 a 2 a 1 a 0 m9/ m8 = 0 a 23 to a 10 a 9 a 9 a 16 a 15 a 14 a 13 a 12 a 11 a 10 a 0 address signals during column address output m9/ m8 = 1 a 23 to a 10 a 18 a 17 a 16 a 15 a 14 a 13 a 12 a 11 a 10 a 0 m8 b. m9/ = 1 m8 figure 7.4 multiplexed address output (example without wait states)
section 7 refresh controller rev. 3.00 sep 27, 2006 page 174 of 872 rej09b0325-0300 2 cas cas cas cas and 2 we we we we modes the cas/ we bit in rfshcr can select two control modes for 16-bit-wide dram: one using ucas and lcas ; the other using uw and lw . these dram pins correspond to h8/3048b group pins as shown in table 7.6. table 7.6 dram pins and h8/3048b group pins dram pin h8/3048b group pin cas/ we we we we = 0 (2 we we we we mode) cas/ we we we we = 1 (2 cas cas cas cas mode) hwr uw ucas lwr lw lcas rd cas we cs 3 ras ras figure 7.5 (1) shows the interface timing for 2 we dram. figure 7.5 (2) shows the interface timing for 2 cas dram. cs ( ras ) 3 rd ( cas ) hwr ( uw ) lwr ( lw ) rfsh as read cycle write cycle refresh cycle * row column row column area 3 top address note: * 16-bit access address bus figure 7.5(1) dram control signal output timing (2 we we we we mode)
section 7 refresh controller rev. 3.00 sep 27, 2006 page 175 of 872 rej09b0325-0300 cs ( ras ) 3 hwr ( ucas ) lwr ( lcas ) rd ( we ) rfsh as read cycle write cycle refresh cycle * row column row column area 3 top address note: * 16-bit access address bus figure 7.5(2) dram control signal output timing (2 cas cas cas cas mode) refresh cycle priority order when there are simultaneous bus requests, the priority order is: (high) external bus master > refresh controller > dma controller > cpu (low) for details see section 6.3.7, bus arbiter operation. wait state insertion when bit ast3 is set to 1 in astcr, bus controller settings can cause wait states to be inserted into bus cycles and refresh cycles. for details see section 6.3.5, wait modes.
section 7 refresh controller rev. 3.00 sep 27, 2006 page 176 of 872 rej09b0325-0300 self-refresh mode some dram devices have a self-refresh function. after the srfmd bit is set to 1 in rfshcr, when a transition to software standby mode occurs, the cas and ras outputs go low in that order so that the dram self-refresh function can be used. on exit from software standby mode, the cas and ras outputs both go high. table 7.7 shows the pin states in software standby mode. figure 7.6 shows the signal output timing. table 7.7 pin states in software standby mode (1) (psrame = 0, drame = 1) software standby mode srfmd = 0 srfmd = 1 (self-refresh mode) signal cas/ we we we we = 0 cas/ we we we we = 1 cas/ we we we we = 0 cas/ we we we we = 1 hwr high-impedance high-impedance high low lwr high-impedance high-impedance high low rd high-impedance high-impedance low high cs 3 high high low low rfsh high high low low
section 7 refresh controller rev. 3.00 sep 27, 2006 page 177 of 872 rej09b0325-0300 cs ( ras ) rd ( cas ) hwr ( uw ) lwr ( lw ) rfsh 3 high high cs ( ras ) rd ( we ) rfsh 3 software standby mode high-impedance oscillator settling time a. 2 we mode (srfmd = 1) b. 2 cas mode (srfmd = 1) software standby mode high-impedance oscillator settling time address bus address bus hwr ( ucas ) lwr ( lcas ) figure 7.6 signal output timing in self-refresh mode (psrame = 0, drame = 1)
section 7 refresh controller rev. 3.00 sep 27, 2006 page 178 of 872 rej09b0325-0300 operation in power-down state the refresh controller operates in sleep mode. it does not operate in hardware standby mode. in software standby mode rtcnt is initialized, but rfshcr, rtmcsr bits 5 to 3, and rtcor retain their settings prior to the transition to software standby mode. example 1: connection to 2 we we we we 1-mbit dram (1-mbyte mode) figure 7.7 shows typical interconnections to a 2 we 1-mbit dram, and the corresponding address map. figure 7.8 shows a setup procedure to be followed by a program for this example. after power-up the dram must be refreshed to initialize its internal state. initialization takes a certain length of time, which can be measured by using an interrupt from another timer module, or by counting the number of times rtmcsr bit 7 (cmf) is set. note that no refresh cycle is executed for the first refresh request after exit from the reset state or standby mode (the first time the cmf flag is set; see figure 7.3). when using this example, check the dram device characteristics carefully and use a procedure that fits them. h8/3048b group a a a a a a a a 8 7 6 5 4 3 2 1 cs rd hwr lwr 3 d to d 0 15 a a a a a a a a 7 6 5 4 3 2 1 0 ras cas uw lw oe i/o to i/o 15 0 h'60000 h'7ffff a. interconnections (example) dram area area 3 (1-mbyte mode) b. address map 2 we 1-mbit dram with 16-bit organization figure 7.7 interconnections and address map for 2 we we we we 1-mbit dram (example)
section 7 refresh controller rev. 3.00 sep 27, 2006 page 179 of 872 rej09b0325-0300 set area 3 for 16-bit access set p8 ddr to 1 for output set rtcor set bits cks2 to cks0 in rtmcsr write h'23 in rfshcr wait for dram to be initialized dram can be accessed cs 13 figure 7.8 setup procedure for 2 we we we we 1-mbit dram (1-mbyte mode)
section 7 refresh controller rev. 3.00 sep 27, 2006 page 180 of 872 rej09b0325-0300 example 2: connection to 2 we we we we 4-mbit dram (16-mbyte mode) figure 7.9 shows typical interconnections to a single 2 we 4-mbit dram, and the corresponding address map. figure 7.10 shows a setup procedure to be followed by a program for this example. the dram in this example has 10-bit row addresses and 8-bit column addresses. its address area is h'600000 to h'67ffff. a a a a a a a a 8 7 6 5 4 3 2 1 cs rd hwr lwr 3 d to d 0 15 a a a a a a a a 7 6 5 4 3 2 1 0 ras cas uw lw oe i/o to i/o 15 0 a a 18 17 a a 9 8 h'600000 h'67ffff h'680000 h'7fffff h8/3048b group 2 we 4-mbit dram with 10-bit row address, 8-bit column address, and 16-bit organization a. interconnections (example) b. address map dram area not used area 3 (16-mbyte mode) figure 7.9 interconnections and address map for 2 we we we we 4-mbit dram (example)
section 7 refresh controller rev. 3.00 sep 27, 2006 page 181 of 872 rej09b0325-0300 set area 3 for 16-bit access set p8 ddr to 1 for output set rtcor set bits cks2 to cks0 in rtmcsr write h'23 in rfshcr wait for dram to be initialized dram can be accessed cs 13 figure 7.10 setup procedure for 2 we we we we 4-mbit dram with 10-bit row address and 8-bit column address (16-mbyte mode)
section 7 refresh controller rev. 3.00 sep 27, 2006 page 182 of 872 rej09b0325-0300 example 3: connection to 2 cas cas cas cas 4-mbit dram (16-mbyte mode) figure 7.11 shows typical interconnections to a single 2 cas 4-mbit dram, and the corresponding address map. figure 7.12 shows a setup procedure to be followed by a program for this example. the dram in this example has 9-bit row addresses and 9-bit column addresses. its address area is h'600000 to h'67ffff. a a a a a a a a a 9 8 7 6 5 4 3 2 1 cs hwr lwr rd 3 d to d 0 a a a a a a a a a 8 7 6 5 4 3 2 1 0 ras ucas lcas we oe i/o to i/o 15 0 15 h'600000 h'67ffff h'680000 h'7fffff h8/3048b group 2 cas 4-mbit dram with 9-bit row address, 9-bit column address, and 16-bit organization figure 7.11 interconnections and address map for 2 cas cas cas cas 4-mbit dram (example)
section 7 refresh controller rev. 3.00 sep 27, 2006 page 183 of 872 rej09b0325-0300 set area 3 for 16-bit access set p8 ddr to 1 for output set rtcor set bits cks2 to cks0 in rtmcsr write h'3b in rfshcr wait for dram to be initialized dram can be accessed cs 13 figure 7.12 setup procedure for 2 cas cas cas cas 4-mbit dram with 9-bit row address and 9-bit column address (16-mbyte mode) example 4: connection to multiple 4-mbit dram chips (16-mbyte mode) figure 7.13 shows an example of interconnections to two 2 cas 4-mbit dram chips, and the corresponding address map. up to four dram chips can be connected to area 3 by decoding upper address bits a 19 and a 20 . figure 7.14 shows a setup procedure to be followed by a program for this example. the dram in this example has 9-bit row addresses and 9-bit column addresses. both chips must be refreshed simultaneously, so the rfsh pin must be used.
section 7 refresh controller rev. 3.00 sep 27, 2006 page 184 of 872 rej09b0325-0300 h'600000 h'67ffff h'680000 h'6fffff h'700000 h'7fffff a to a ras ucas lcas we oe i/o to i/o 15 0 80 no. 1 a to a ras ucas lcas i/o to i/o 15 0 80 no. 2 we oe a a to a 19 9 1 cs hwr lwr rd rfsh 3 d to d 15 0 h8/3048b group 2 cas 4-mbit dram with 9-bit row address, 9-bit column address, and 16-bit organization a. interconnections (example) b. address map no. 1 dram area no. 2 dram area not used area 3 (16-mbyte mode) figure 7.13 interconnections and address map for multiple 2 cas cas cas cas 4-mbit dram chips (example)
section 7 refresh controller rev. 3.00 sep 27, 2006 page 185 of 872 rej09b0325-0300 set area 3 for 16-bit access set p8 ddr to 1 for cs output 13 set rtcor set bits cks2 to cks0 in rtmcsr write h'3f in rfshcr wait for dram to be initialized dram can be accessed figure 7.14 setup procedure for multiple 2 cas cas cas cas 4-mbit dram chips with 9-bit row address and 9-bit column address (16-mbyte mode) 7.3.3 pseudo-static ram refresh control refresh request interval and refresh cycle execution the refresh request interval is determined as in a dram interface, by the settings of rtcor and bits cks2 to cks0 in rtmcsr. the numbers of states required for pseudo-static ram read/write cycles and refresh cycles are the same as for dram (see table 7.4). the state transitions are as shown in figure 7.3.
section 7 refresh controller rev. 3.00 sep 27, 2006 page 186 of 872 rej09b0325-0300 pseudo-static ram control signals figure 7.15 shows the control signals for pseudo-static ram read, write, and refresh cycles. cs rd hwr lwr rfsh as 3 read cycle write cycle * refresh cycle area 3 top address note: * 16-bit access address bus figure 7.15 pseudo-static ram control signal output timing refresh cycle priority order when there are simultaneous bus requests, the priority order is: (high) external bus master > refresh controller > dma controller > cpu (low) for details see section 6.3.7, bus arbiter operation. wait state insertion when bit ast3 is set to 1 in astcr, the wait state controller (wsc) can insert wait states into bus cycles and refresh cycles. for details see section 6.3.5, wait modes.
section 7 refresh controller rev. 3.00 sep 27, 2006 page 187 of 872 rej09b0325-0300 self-refresh mode some pseudo-static ram devices have a self-refresh function. after the srfmd bit is set to 1 in rfshcr, when a transition to software standby mode occurs, the h8/3048b group ? s cs 3 output goes high and its rfsh output goes low so that the pseudo-static ram self-refresh function can be used. on exit from software standby mode, the rfsh output goes high. table 7.8 shows the pin states in software standby mode. figure 7.16 shows the signal output timing. table 7.8 pin states in software standby mode (2) (psrame = 1, drame = 0) software standby mode signal srfmd = 0 srfmd = 1 (self-refresh mode) cs 3 high high rd high-impedance high-impedance hwr high-impedance high-impedance lwr high-impedance high-impedance rfsh high low cs 3 rd hwr lwr rfsh high software standby mode oscillator settling time high-impedance high-impedance high-impedance high-impedance address bus figure 7.16 signal output timing in self-refresh mode (psrame = 1, drame = 0)
section 7 refresh controller rev. 3.00 sep 27, 2006 page 188 of 872 rej09b0325-0300 operation in power-down state the refresh controller operates in sleep mode. it does not operate in hardware standby mode. in software standby mode rtcnt is initialized, but rfshcr, rtmcsr bits 5 to 3, and rtcor retain their settings prior to the transition to software standby mode. example pseudo-static ram may have separate oe and rfsh pins, or these may be combined into a single oe / rfsh pin. figure 7.17 shows an example of a circuit for generating an oe / rfsh signal. check the device characteristics carefully, and design a circuit that fits them. figure 7.18 shows a setup procedure to be followed by a program. h8/3048b group psram rd rfsh oe / rfsh figure 7.17 interconnection to pseudo-static ram with oe oe oe oe / rfsh rfsh rfsh rfsh signal (example)
section 7 refresh controller rev. 3.00 sep 27, 2006 page 189 of 872 rej09b0325-0300 set p8 ddr to 1 for cs output 13 set rtcor set bits cks2 to cks0 in rtmcsr write h'47 in rfshcr wait for psram to be initialized psram can be accessed figure 7.18 setup procedure for pseudo-static ram
section 7 refresh controller rev. 3.00 sep 27, 2006 page 190 of 872 rej09b0325-0300 7.3.4 interval timer to use the refresh controller as an interval timer, clear the psrame and drame both to 0. after setting rtcor, select a clock source with bits cks2 to cks0 in rtmcsr, and set the cmie bit to 1. timing of setting of compare match flag and clearing by compare match the cmf flag in rtcsr is set to 1 by a compare match signal output when the rtcor and rtcnt values match. the compare match signal is generated in the last state in which the values match (when rtcnt is updated from the matching value to a new value). accordingly, when rtcnt and rtcor match, the compare match signal is not generated until the next counter clock pulse. figure 7.19 shows the timing. figure 7.19 timing of setting of cmf flag operation in power-down state the interval timer function operates in sleep mode. it does not operate in hardware standby mode. in software standby mode rtcnt and rtmcsr bits 7 and 6 are initialized, but rtmcsr bits 5 to 3 and rtcor retain their settings prior to the transition to software standby mode.
section 7 refresh controller rev. 3.00 sep 27, 2006 page 191 of 872 rej09b0325-0300 contention between rtcnt write and counter clear if a counter clear signal occurs in the t 3 state of an rtcnt write cycle, clearing of the counter takes priority and the write is not performed. see figure 7.20. figure 7.20 contention between rtcnt write and clear
section 7 refresh controller rev. 3.00 sep 27, 2006 page 192 of 872 rej09b0325-0300 contention between rtcnt write and increment if an increment pulse occurs in the t 3 state of an rtcnt write cycle, writing takes priority and rtcnt is not incremented. see figure 7.21. t 1 t 2 t 3 rtcnt address nm figure 7.21 contention between rtcnt write and increment
section 7 refresh controller rev. 3.00 sep 27, 2006 page 193 of 872 rej09b0325-0300 contention between rtcor write and compare match if a compare match occurs in the t 3 state of an rtcor write cycle, writing takes priority and the compare match signal is inhibited. see figure 7.22. t 1 t 2 t 3 rtcnt address nm n n + 1 figure 7.22 contention between rtcor write and compare match rtcnt operation at internal clock source switchover switching internal clock sources may cause rtcnt to increment, depending on the switchover timing. table 7.9 shows the relation between the time of the switchover (by writing to bits cks2 to cks0) and the operation of rtcnt. the rtcnt input clock is generated from the internal clock source by detecting the falling edge of the internal clock. if a switchover is made from a high clock source to a low clock source, as in case no. 3 in table 7.9, the switchover will be regarded as a falling edge, an rtcnt clock pulse will be generated, and rtcnt will be incremented.
section 7 refresh controller rev. 3.00 sep 27, 2006 page 194 of 872 rej09b0325-0300 table 7.9 internal clock switchover and rtcnt operation no. cks2 to cks0 write timing rtcnt operation 1 low
section 7 refresh controller rev. 3.00 sep 27, 2006 page 195 of 872 rej09b0325-0300 no. cks2 to cks0 write timing rtcnt operation 3 high
section 7 refresh controller rev. 3.00 sep 27, 2006 page 196 of 872 rej09b0325-0300 7.4 interrupt source compare match interrupts (cmi) can be generated when the refresh controller is used as an interval timer. compare match interrupt requests are masked/unmasked with the cmie bit of rtmcsr. 7.5 usage notes when using the dram or pseudo-static ram refresh function, note the following points: ? with the refresh controller, if directly connected dram or psram is disconnected * , the p8 0 / rfsh / irq 0 pin and the p8 1 / cs 3 / irq 1 pin may both become low-level outputs simultaneously. note: * when the dram enable bit (drame) or psram enable bit (psrame) in the refresh control register (rfshcr) is cleared to 0 after being set to 1. address bus area 3 start address p8 0 / rfsh / irq 0 p8 1 / cs 3 / irq 1 figure 7.23 operation when dram/psram connection is switched ? refresh cycles are not executed while the bus is released, during software standby mode, and when a bus cycle is greatly prolonged by insertion of wait states. when these conditions occur, other means of refreshing are required. ? if refresh requests occur while the bus is released, the first request is held and one refresh cycle is executed after the bus-released state ends. figure 7.24 shows the bus cycles in this case.
section 7 refresh controller rev. 3.00 sep 27, 2006 page 197 of 872 rej09b0325-0300 rfsh back refresh request bus-released state refresh cycle cpu cycle refresh cycle figure 7.24 refresh cycles when bus is released ? if a bus cycle is prolonged by insertion of wait states, the first refresh request is held, as in the bus-released state. ? if there is contention with a bus request from an external bus master when making a transition to software standby mode, a one-state bus-released state may occur immediately before the transition to software standby mode (see figure 7.25). when using software standby mode, clear the brle bit to 0 in brcr before executing the sleep instruction. when making a transition to self-refresh mode, the strobe waveform output may not be guaranteed due to the same kind of contention. this, too, can be prevented by clearing the brle bit to 0 in brcr. breq back figure 7.25 contention between bus-released state and software standby mode
section 7 refresh controller rev. 3.00 sep 27, 2006 page 198 of 872 rej09b0325-0300
section 8 dma controller rev. 3.00 sep 27, 2006 page 199 of 872 rej09b0325-0300 section 8 dma controller 8.1 overview the h8/3048b group has an on-chip dma controller (dmac) that can transfer data on up to four channels. when the dma controller is not used, it can be independently halted to conserve power. for details see section 20.6, module standby function. 8.1.1 features dmac features are listed below. ? selection of short address mode or full address mode short address mode: ? 8-bit source address and 24-bit destination address, or vice versa ? maximum four channels available ? selection of i/o mode, idle mode, or repeat mode full address mode: ? 24-bit source and destination addresses ? maximum two channels available ? selection of normal mode or block transfer mode ? directly addressable 16-mbyte address space ? selection of byte or word transfer ? activation by internal interrupts, external requests, or auto-request (depending on transfer mode) ? 16-bit integrated timer unit (itu) compare match/input capture interrupts (four) ? serial communication interface (sci channel 0) transmit-data-empty/receive-data-full interrupts ? external requests ? auto-request
section 8 dma controller rev. 3.00 sep 27, 2006 page 200 of 872 rej09b0325-0300 8.1.2 block diagram figure 8.1 shows a dmac block diagram. imia0 imia1 imia2 imia3 txi0 rxi0 dreq0 dreq1 tend0 tend1 dend0a dend0b dend1a dend1b dtcr0a dtcr0b dtcr1a dtcr1b control logic data buffer address buffer arithmetic-logic unit mar0a mar0b mar1a mar1b ioar0a ioar0b ioar1a ioar1b etcr0a etcr0b etcr1a etcr1b internal address bus internal interrupts interrupt signals internal data bus module data bus legend: dtcr: mar: ioar: etcr: data transfer control register memory address register i/o address register execute transfer count register channel 0a channel 0b channel 1a channel 1b channel 0 channel 1 figure 8.1 block diagram of dmac
section 8 dma controller rev. 3.00 sep 27, 2006 page 201 of 872 rej09b0325-0300 8.1.3 functional overview table 8.1 gives an overview of the dmac functions. table 8.1 dmac functional overview address reg. length transfer mode activation source destination ? compare match/ input capture a interrupts from itu channels 0 to 3 ? transmit-data-empty interrupt from sci channel 0 24 8 ? receive-data-full interrupt from sci channel 0 824 short address mode i/o mode ? transfers one byte or one word per request ? increments or decrements the memory address by 1 or 2 ? executes 1 to 65,536 transfers idle mode ? transfers one byte or one word per request ? holds the memory address fixed ? executes 1 to 65,536 transfers repeat mode ? transfers one byte or one word per request ? increments or decrements the memory address by 1 or 2 ? executes a specified number (1 to 255) of transfers, then returns to the initial state and continues ? external request 24 8
section 8 dma controller rev. 3.00 sep 27, 2006 page 202 of 872 rej09b0325-0300 address reg. length transfer mode activation source destination full address mode normal mode ? auto-request ? retains the transfer request internally ? executes a specified number (1 to 65,536) of transfers continuously ? selection of burst mode or cycle-steal mode ? external request ? transfers one byte or one word per request ? executes 1 to 65,536 transfers ? auto-request ? external request 24 24 block transfer ? transfers one block of a specified size per request ? executes 1 to 65,536 transfers ? allows either the source or destination to be a fixed block area ? block size can be 1 to 255 bytes or words ? compare match/ input capture a interrupts from itu channels 0 to 3 ? external request 24 24
section 8 dma controller rev. 3.00 sep 27, 2006 page 203 of 872 rej09b0325-0300 8.1.4 input/output pins table 8.2 lists the dmac pins. table 8.2 dmac pins channel name abbre- viation input/ output function 0 dma request 0 dreq 0 input external request for dmac channel 0 transfer end 0 tend 0 output transfer end on dmac channel 0 1 dma request 1 dreq 1 input external request for dmac channel 1 transfer end 1 tend 1 output transfer end on dmac channel 1 note: external requests cannot be made to channel a in short address mode. 8.1.5 register configuration table 8.3 lists the dmac registers.
section 8 dma controller rev. 3.00 sep 27, 2006 page 204 of 872 rej09b0325-0300 table 8.3 dmac registers channel address * name abbreviation r/w initial value 0 h'ff20 memory address register 0ar mar0ar r/w h'ff h'ff21 memory address register 0ae mar0ae r/w undetermined h'ff22 memory address register 0ah mar0ah r/w undetermined h'ff23 memory address register 0al mar0al r/w undetermined h'ff26 i/o address register 0a ioar0a r/w undetermined h'ff24 execute transfer count register 0ah etcr0ah r/w undetermined h'ff25 execute transfer count register 0al etcr0al r/w undetermined h'ff27 data transfer control register 0a dtcr0a r/w h'00 h'ff28 memory address register 0br mar0br r/w h'ff h'ff29 memory address register 0be mar0be r/w undetermined h'ff2a memory address register 0bh mar0bh r/w undetermined h'ff2b memory address register 0bl mar0bl r/w undetermined h'ff2e i/o address register 0b ioar0b r/w undetermined h'ff2c execute transfer count register 0bh etcr0bh r/w undetermined h'ff2d execute transfer count register 0bl etcr0bl r/w undetermined h'ff2f data transfer control register 0b dtcr0b r/w h'00 1 h'ff30 memory address register 1ar mar1ar r/w h'ff h'ff31 memory address register 1ae mar1ae r/w undetermined h'ff32 memory address register 1ah mar1ah r/w undetermined h'ff33 memory address register 1al mar1al r/w undetermined h'ff36 i/o address register 1a ioar1a r/w undetermined h'ff34 execute transfer count register 1ah etcr1ah r/w undetermined h'ff35 execute transfer count register 1al etcr1al r/w undetermined h'ff37 data transfer control register 1a dtcr1a r/w h'00 h'ff38 memory address register 1br mar1br r/w h'ff h'ff39 memory address register 1be mar1be r/w undetermined h'ff3a memory address register 1bh mar1bh r/w undetermined h'ff3b memory address register 1bl mar1bl r/w undetermined h'ff3e i/o address register 1b ioar1b r/w undetermined h'ff3c execute transfer count register 1bh etcr1bh r/w undetermined h'ff3d execute transfer count register 1bl etcr1bl r/w undetermined h'ff3f data transfer control register 1b dtcr1b r/w h'00 note: * the lower 16 bits of the address are indicated.
section 8 dma controller rev. 3.00 sep 27, 2006 page 205 of 872 rej09b0325-0300 8.2 register descriptions (short address mode) in short address mode, transfers can be carried out independently on channels a and b. short address mode is selected by bits dts2a and dts1a in data transfer control register a (dtcra) as indicated in table 8.4. table 8.4 selection of short and full address modes channel bit 2: dts2a bit 1: dts1a description 0 1 1 dmac channel 0 operates as one channel in full address mode other than above dmac channels 0a and 0b operate as two independent channels in short address mode 1 1 1 dmac channel 1 operates as one channel in full address mode other than above dmac channels 1a and 1b operate as two independent channels in short address mode 8.2.1 memory address registers (mar) a memory address register (mar) is a 32-bit readable/writable register that specifies a source or destination address. the transfer direction is determined automatically from the activation source. an mar consists of four 8-bit registers designated marr, mare, marh, and marl. all bits of marr are reserved: they cannot be modified and are always read as 1. bit initial value read/write 31 1 ? source or destination address 30 1 ? 29 1 ? 28 1 ? 27 1 ? 26 1 ? 25 1 ? 24 1 ? 23 r/w 22 r/w 21 r/w 20 r/w 19 r/w 18 r/w 17 r/w 16 r/w 15 r/w 14 r/w 13 r/w 12 r/w 11 r/w 10 r/w 9 r/w 8 r/w 7 r/w 6 r/w 5 r/w 4 r/w 3 r/w 2 r/w 1 r/w 0 r/w marr mare marh marl undetermined an mar functions as a source or destination address register depending on how the dmac is activated: as a destination address register if activation is by a receive-data-full interrupt from the serial communication interface (sci) (channel 0), and as a source address register otherwise.
section 8 dma controller rev. 3.00 sep 27, 2006 page 206 of 872 rej09b0325-0300 the mar value is incremented or decremented each time one byte or word is transferred, automatically updating the source or destination memory address. for details, see section 8.2.4, data transfer control registers (dtcr). the mars are not initialized by a reset or in standby mode. 8.2.2 i/o address registers (ioar) an i/o address register (ioar) is an 8-bit readable/writable register that specifies a source or destination address. the ioar value is the lower 8 bits of the address. the upper 16 address bits are all 1 (h'ffff). bit initial value read/write 7 r/w 6 r/w 5 r/w 4 r/w 3 r/w 0 r/w 2 r/w 1 r/w source or destination address undetermined an ioar functions as a source or destination address register depending on how the dmac is activated: as a source address register if activation is by a receive-data-full interrupt from the sci (channel 0), and as a destination address register otherwise. the ioar value is held fixed. it is not incremented or decremented when a transfer is executed. the ioars are not initialized by a reset or in standby mode. 8.2.3 execute transfer count registers (etcr) an execute transfer count register (etcr) is a 16-bit readable/writable register that specifies the number of transfers to be executed. these registers function in one way in i/o mode and idle mode, and another way in repeat mode.
section 8 dma controller rev. 3.00 sep 27, 2006 page 207 of 872 rej09b0325-0300 i/o mode and idle mode bit initial value read/write 14 r/w 12 r/w 10 r/w 8 r/w 6 r/w 0 r/w 4 r/w 2 r/w transfer counter undetermined 15 r/w 13 r/w 11 r/w 9 r/w 7 r/w 1 r/w 5 r/w 3 r/w in i/o mode and idle mode, etcr functions as a 16-bit counter. the count is decremented by 1 each time one transfer is executed. the transfer ends when the count reaches h'0000. repeat mode bit initial value read/write 7 r/w 6 r/w 5 r/w 4 r/w 3 r/w 0 r/w 2 r/w 1 r/w undetermined transfer counter etcrh bit initial value read/write 7 r/w 6 r/w 5 r/w 4 r/w 3 r/w 0 r/w 2 r/w 1 r/w undetermined initial count etcrl in repeat mode, etcrh functions as an 8-bit transfer counter and etcrl holds the initial transfer count. etcrh is decremented by 1 each time one transfer is executed. when etcrh reaches h'00, the value in etcrl is reloaded into etcrh and the same operation is repeated. the etcrs are not initialized by a reset or in standby mode.
section 8 dma controller rev. 3.00 sep 27, 2006 page 208 of 872 rej09b0325-0300 8.2.4 data transfer control registers (dtcr) a data transfer control register (dtcr) is an 8-bit readable/writable register that controls the operation of one dmac channel. bit initial value read/write 7 dte 0 r/w 6 dtsz 0 r/w 5 dtid 0 r/w 4 rpe 0 r/w 3 dtie 0 r/w 0 dts0 0 r/w 2 dts2 0 r/w 1 dts1 0 r/w data transfer enable enables or disables data transfer data transfer interrupt enable enables or disables the cpu interrupt at the end of the transfer data transfer select these bits select the data transfer activation source data transfer size selects byte or word size data transfer increment/decrement selects whether to increment or decrement the memory address register repeat enable selects repeat mode the dtcrs are initialized to h'00 by a reset and in standby mode. bit 7?data transfer enable (dte): enables or disables data transfer on a channel. when the dte bit is set to 1, the channel waits for a transfer to be requested, and executes the transfer when activated as specified by bits dts2 to dts0. when dte is 0, the channel is disabled and does not accept transfer requests. dte is set to 1 by reading the register when dte is 0, then writing 1. bit 7: dte description 0 data transfer is disabled. in i/o mode or idle mode, dte is cleared to 0 when the specified number of transfers have been completed. (initial value) 1 data transfer is enabled if dtie is set to 1, a cpu interrupt is requested when dte is cleared to 0.
section 8 dma controller rev. 3.00 sep 27, 2006 page 209 of 872 rej09b0325-0300 bit 6?data transfer size (dtsz): selects the data size of each transfer. bit 6: dtsz description 0 byte-size transfer (initial value) 1 word-size transfer bit 5?data transfer increment/decrement (dtid): selects whether to increment or decrement the memory address register (mar) after a data transfer in i/o mode or repeat mode. bit 5: dtid description 0 mar is incremented after each data transfer ? if dtsz = 0, mar is incremented by 1 after each transfer ? if dtsz = 1, mar is incremented by 2 after each transfer 1 mar is decremented after each data transfer ? if dtsz = 0, mar is decremented by 1 after each transfer ? if dtsz = 1, mar is decremented by 2 after each transfer mar is not incremented or decremented in idle mode. bit 4?repeat enable (rpe): selects whether to transfer data in i/o mode, idle mode, or repeat mode. bit 4: rpe bit 3: dtie description 0 0 i/o mode (initial value) 1 1 0 repeat mode 1 idle mode operations in these modes are described in sections 8.4.2, i/o mode, 8.4.3, idle mode, and 8.4.4, repeat mode. bit 3?data transfer interrupt enable (dtie): enables or disables the cpu interrupt (dend) requested when the dte bit is cleared to 0. bit 3: dtie description 0 the dend interrupt requested by dte is disabled (initial value) 1 the dend interrupt requested by dte is enabled
section 8 dma controller rev. 3.00 sep 27, 2006 page 210 of 872 rej09b0325-0300 bits 2 to 0?data transfer select (dts2, dts1, dts0): these bits select the data transfer activation source. some of the selectable sources differ between channels a and b. * note: * refer to section 8.3.4, data transfer control registers (dtcr). bit 2: dts2 bit 1: dts1 bit 0: dts0 description 0 0 0 compare match/input capture a interrupt from itu channel 0 (initial value) 1 compare match/input capture a interrupt from itu channel 1 1 0 compare match/input capture a interrupt from itu channel 2 1 compare match/input capture a interrupt from itu channel 3 1 0 0 transmit-data-empty interrupt from sci channel 0 1 receive-data-full interrupt from sci channel 0 1 0 falling edge of dreq input (channel b) transfer in full address mode (channel a) 1 low level of dreq input (channel b) transfer in full address mode (channel a) the same internal interrupt can be selected as an activation source for two or more channels at once. in that case the channels are activated in a priority order, highest-priority channel first. for the priority order, see section 8.4.9, dmac multiple-channel operation. when a channel is enabled (dte = 1), its selected dmac activation source cannot generate a cpu interrupt.
section 8 dma controller rev. 3.00 sep 27, 2006 page 211 of 872 rej09b0325-0300 8.3 register descriptions (full address mode) in full address mode the a and b channels operate together. full address mode is selected as indicated in table 8.4. 8.3.1 memory address registers (mar) a memory address register (mar) is a 32-bit readable/writable register. mara functions as the source address register of the transfer, and marb as the destination address register. an mar consists of four 8-bit registers designated marr, mare, marh, and marl. all bits of marr are reserved: they cannot be modified and are always read as 1. bit initial value read/write 31 1 ? source or destination address 30 1 ? 29 1 ? 28 1 ? 27 1 ? 26 1 ? 25 1 ? 24 1 ? 23 r/w 22 r/w 21 r/w 20 r/w 19 r/w 18 r/w 17 r/w 16 r/w 15 r/w 14 r/w 13 r/w 12 r/w 11 undetermined r/w 10 r/w 9 r/w 8 r/w 7 r/w 6 r/w 5 r/w 4 r/w 3 r/w 2 r/w 1 r/w 0 r/w marr mare marh marl the mar value is incremented or decremented each time one byte or word is transferred, automatically updating the source or destination memory address. for details, see section 8.3.4, data transfer control registers (dtcr). the mars are not initialized by a reset or in standby mode. 8.3.2 i/o address registers (ioar) the i/o address registers (ioars) are not used in full address mode.
section 8 dma controller rev. 3.00 sep 27, 2006 page 212 of 872 rej09b0325-0300 8.3.3 execute transfer count registers (etcr) an execute transfer count register (etcr) is a 16-bit readable/writable register that specifies the number of transfers to be executed. the functions of these registers differ between normal mode and block transfer mode. normal mode etcra: bit initial value read/write 14 r/w 12 r/w 10 r/w 8 r/w 6 r/w 0 r/w 4 r/w 2 r/w block transfer counter undetermined 15 r/w 13 r/w 11 r/w 9 r/w 7 r/w 1 r/w 5 r/w 3 r/w etcrb: is not used in normal mode. in normal mode etcra functions as a 16-bit transfer counter. the count is decremented by 1 each time one transfer is executed. the transfer ends when the count reaches h'0000. etcrb is not used.
section 8 dma controller rev. 3.00 sep 27, 2006 page 213 of 872 rej09b0325-0300 block transfer mode etcra: bit initial value read/write 7 r/w 6 r/w 5 r/w 4 r/w 3 r/w 0 r/w 2 r/w 1 r/w undetermined block size counter etcrah bit initial value read/write 7 r/w 6 r/w 5 r/w 4 r/w 3 r/w 0 r/w 2 r/w 1 r/w undetermined initial block size etcral etcrb: bit initial value read/write 14 r/w 12 r/w 10 r/w 8 r/w 6 r/w 0 r/w 4 r/w 2 r/w block transfer counter undetermined 15 r/w 13 r/w 11 r/w 9 r/w 7 r/w 1 r/w 5 r/w 3 r/w in block transfer mode, etcrah functions as an 8-bit block size counter. etcral holds the initial block size. etcrah is decremented by 1 each time one byte or word is transferred. when the count reaches h'00, etcrah is reloaded from etcral. blocks consisting of an arbitrary number of bytes or words can be transferred repeatedly by setting the same initial block size value in etcrah and etcral. in block transfer mode etcrb functions as a 16-bit block transfer counter. etcrb is decremented by 1 each time one block is transferred. the transfer ends when the count reaches h'0000. the etcrs are not initialized by a reset or in standby mode.
section 8 dma controller rev. 3.00 sep 27, 2006 page 214 of 872 rej09b0325-0300 8.3.4 data transfer control registers (dtcr) the data transfer control registers (dtcrs) are 8-bit readable/writable registers that control the operation of the dmac channels. a channel operates in full address mode when bits dts2a and dts1a are both set to 1 in dtcra. dtcra and dtcrb have different functions in full address mode. dtcra bit initial value read/write 7 dte 0 r/w 6 dtsz 0 r/w 5 said 0 r/w 4 saide 0 r/w 3 dtie 0 r/w 0 dts0a 0 r/w 2 dts2a 0 r/w 1 dts1a 0 r/w data transfer enable enables or disables data transfer enables or disables the cpu interrupt at the end of the transfer data transfer size selects byte or word size source address increment/decrement data transfer select 2a and 1a these bits must both be set to 1 data transfer interrupt enable source address increment/ decrement enable these bits select whether the source address register (mara) is incremented, decremented, or held fixed during the data transfer selects block transfer mode data transfer select 0a dtcra is initialized to h'00 by a reset and in standby mode. bit 7?data transfer enable (dte): together with the dtme bit in dtcrb, this bit enables or disables data transfer on the channel. when the dtme and dte bits are both set to 1, the channel is enabled. if auto-request is specified, data transfer begins immediately. otherwise, the channel waits for transfers to be requested. when the specified number of transfers have been completed, the dte bit is automatically cleared to 0. when dte is 0, the channel is disabled and does not accept transfer requests. dte is set to 1 by reading the register when dte is 0, then writing 1.
section 8 dma controller rev. 3.00 sep 27, 2006 page 215 of 872 rej09b0325-0300 bit 7: dte description 0 data transfer is disabled (dte is cleared to 0 when the specified number of transfers have been completed) (initial value) 1 data transfer is enabled if dtie is set to 1, a cpu interrupt is requested when dte is cleared to 0. bit 6?data transfer size (dtsz): selects the data size of each transfer. bit 6: dtsz description 0 byte-size transfer (initial value) 1 word-size transfer bit 5?source address increment/decrement (said) and bit 4?source address increment/decrement enable (saide): these bits select whether the source address register (mara) is incremented, decremented, or held fixed during the data transfer. bit 5: said bit 4: saide description 0 0 mara is held fixed (initial value) 1 mara is incremented after each data transfer ? if dtsz = 0, mara is incremented by 1 after each transfer ? if dtsz = 1, mara is incremented by 2 after each transfer 1 0 mara is held fixed 1 mara is decremented after each data transfer ? if dtsz = 0, mara is decremented by 1 after each transfer ? if dtsz = 1, mara is decremented by 2 after each transfer
section 8 dma controller rev. 3.00 sep 27, 2006 page 216 of 872 rej09b0325-0300 bit 3?data transfer interrupt enable (dtie): enables or disables the cpu interrupt (dend) requested when the dte bit is cleared to 0. bit 3: dtie description 0 the dend interrupt requested by dte is disabled (initial value) 1 the dend interrupt requested by dte is enabled bits 2 and 1?data transfer select 2a and 1a (dts2a, dts1a): a channel operates in full address mode when dts2a and dts1a are both set to 1. bit 0?data transfer select 0a (dts0a): selects normal mode or block transfer mode. bit 0: dts0a description 0 normal mode (initial value) 1 block transfer mode operations in these modes are described in sections 8.4.5, normal mode, and 8.4.6, block transfer mode.
section 8 dma controller rev. 3.00 sep 27, 2006 page 217 of 872 rej09b0325-0300 dtcrb bit initial value read/write 7 dtme 0 r/w 6 ? 0 r/w 5 daid 0 r/w 4 daide 0 r/w 3 tms 0 r/w 0 dts0b 0 r/w 2 dts2b 0 r/w 1 dts1b 0 r/w data transfer master enable enables or disables data transfer, together with the dte bit, and is cleared to 0 by an interrupt reserved bit destination address increment/decrement data transfer select 2b to 0b these bits select the data transfer activation source transfer mode select destination address increment/decrement enable these bits select whether the destination address register (marb) is incremented, decremented, or held fixed during the data transfer selects whether the block area is the source or destination in block transfer mode dtcrb is initialized to h'00 by a reset and in standby mode. bit 7?data transfer master enable (dtme): together with the dte bit in dtcra, this bit enables or disables data transfer. when the dtme and dte bits are both set to 1, the channel is enabled. when an nmi interrupt occurs dtme is cleared to 0, suspending the transfer so that the cpu can use the bus. the suspended transfer resumes when dtme is set to 1 again. for further information on operation in block transfer mode, see section 8.6.6, nmi interrupts and block transfer mode. dtme is set to 1 by reading the register while dtme = 0, then writing 1. bit 7: dtme description 0 data transfer is disabled (dtme is cleared to 0 when an nmi interrupt occurs) (initial value) 1 data transfer is enabled
section 8 dma controller rev. 3.00 sep 27, 2006 page 218 of 872 rej09b0325-0300 bit 6?reserved: although reserved, this bit can be written and read. bit 5?destination address increment/decrement (daid) and bit 4?destination address increment/decrement enable (daide): these bits select whether the destination address register (marb) is incremented, decremented, or held fixed during the data transfer. bit 5: daid bit 4: daide description 0 0 marb is held fixed (initial value) 1 marb is incremented after each data transfer ? if dtsz = 0, marb is incremented by 1 after each data transfer ? if dtsz = 1, marb is incremented by 2 after each data transfer 1 0 marb is held fixed 1 marb is decremented after each data transfer ? if dtsz = 0, marb is decremented by 1 after each data transfer ? if dtsz = 1, marb is decremented by 2 after each data transfer bit 3?transfer mode select (tms): selects whether the source or destination is the block area in block transfer mode. bit 3: tms description 0 destination is the block area in block transfer mode (initial value) 1 source is the block area in block transfer mode
section 8 dma controller rev. 3.00 sep 27, 2006 page 219 of 872 rej09b0325-0300 bits 2 to 0?data transfer select 2b to 0b (dts2b, dts1b, dts0b): these bits select the data transfer activation source. the selectable activation sources differ between normal mode and block transfer mode. ? normal mode bit 2: dts2b bit 1: dts1b bit 0: dts0b description 000auto-request (burst mode)(initial value) 1 cannot be used 1 0 auto-request (cycle-steal mode) 1 cannot be used 100c annot be used 1 cannot be used 1 0 falling edge of dreq 1 low level input at dreq ? block transfer mode bit 2: dts2b bit 1: dts1b bit 0: dts0b description 000compare match/input capture a interrupt from itu channel 0 (initial value) 1 compare match/input capture a interrupt from itu channel 1 1 0 compare match/input capture a interrupt from itu channel 2 1 compare match/input capture a interrupt from itu channel 3 100c annot be used 1 cannot be used 1 0 falling edge of dreq 1 cannot be used the same internal interrupt can be selected to activate two or more channels. the channels are activated in a priority order, highest priority first. for the priority order, see section 8.4.9, dmac multiple-channel operation.
section 8 dma controller rev. 3.00 sep 27, 2006 page 220 of 872 rej09b0325-0300 8.4 operation 8.4.1 overview table 8.5 summarizes the dmac modes. table 8.5 dmac modes transfer mode activation notes compare match/input capture a interrupt from itu channels 0 to 3 transmit-data-empty and receive-data-full interrupts from sci channel 0 short address mode i/o mode idle mode repeat mode external request ? up to four channels can operate independently ? only the b channels support external requests auto-request normal mode external request compare match/input capture a interrupt from itu channels 0 to 3 full address mode block transfer mode external request ? a and b channels are paired; up to two channels are available ? burst mode or cycle-steal mode can be selected for auto-requests a summary of operations in these modes follows. i/o mode one byte or word is transferred per request. a designated number of these transfers are executed. a cpu interrupt can be requested at completion of the designated number of transfers. one 24-bit address and one 8-bit address are specified. the transfer direction is determined automatically from the activation source. idle mode one byte or word is transferred per request. a designated number of these transfers are executed. a cpu interrupt can be requested at completion of the designated number of transfers. one 24-bit address and one 8-bit address are specified. the addresses are held fixed. the transfer direction is determined automatically from the activation source.
section 8 dma controller rev. 3.00 sep 27, 2006 page 221 of 872 rej09b0325-0300 repeat mode one byte or word is transferred per request. a designated number of these transfers are executed. when the designated number of transfers are completed, the initial address and counter value are restored and operation continues. no cpu interrupt is requested. one 24-bit address and one 8-bit address are specified. the transfer direction is determined automatically from the activation source. normal mode auto-request: the dmac is activated by register setup alone, and continues executing transfers until the designated number of transfers have been completed. a cpu interrupt can be requested at completion of the transfers. both addresses are 24-bit addresses. ? cycle-steal mode the bus is released to another bus master after each byte or word is transferred. ? burst mode unless requested by a higher-priority bus master, the bus is not released until the designated number of transfers have been completed. external request: one byte or word is transferred per request. a designated number of these transfers are executed. a cpu interrupt can be requested at completion of the designated number of transfers. both addresses are 24-bit addresses. block transfer mode one block of a specified size is transferred per request. a designated number of block transfers are executed. at the end of each block transfer, one address is restored to its initial value. when the designated number of blocks have been transferred, a cpu interrupt can be requested. both addresses are 24-bit addresses.
section 8 dma controller rev. 3.00 sep 27, 2006 page 222 of 872 rej09b0325-0300 8.4.2 i/o mode i/o mode can be selected independently for each channel. one byte or word is transferred at each transfer request in i/o mode. a designated number of these transfers are executed. one address is specified in the memory address register (mar), the other in the i/o address register (ioar). the direction of transfer is determined automatically from the activation source. the transfer is from the address specified in ioar to the address specified in mar if activated by an sci channel 0 receive-data-full interrupt, and from the address specified in mar to the address specified in ioar otherwise. table 8.6 indicates the register functions in i/o mode. table 8.6 register functions in i/o mode function register activated by sci0 receive- data-full interrupt other activation initial setting operation 23 0 mar destination address register source address register destination or source address incremented or decremented once per transfer all 1s ioar 23 0 7 source address register destination address register source or destination address held fixed 15 0 etcr transfer counter transfer counter number of transfers decremented once per transfer until h'0000 is reached and transfer ends legend: mar: memory address register ioar: i/o address register etcr: execute transfer count register mar and ioar specify the source and destination addresses. mar specifies a 24-bit source or destination address, which is incremented or decremented as each byte or word is transferred. ioar specifies the lower 8 bits of a fixed address. the upper 16 bits are all 1s. ioar is not incremented or decremented.
section 8 dma controller rev. 3.00 sep 27, 2006 page 223 of 872 rej09b0325-0300 figure 8.2 illustrates how i/o mode operates. address t address b transfer legend: l = initial setting of mar n = initial setting of etcr address t = l address b = l + ( ? 1)  (2  n ? 1) dtid ioar 1 byte or word is transferred per request dtsz figure 8.2 operation in i/o mode the transfer count is specified as a 16-bit value in etcr. the etcr value is decremented by 1 at each transfer. when the etcr value reaches h'0000, the dte bit is cleared and the transfer ends. if the dtie bit is set to 1, a cpu interrupt is requested at this time. the maximum transfer count is 65,536, obtained by setting etcr to h'0000. transfers can be requested (activated) by compare match/input capture a interrupts from itu channels 0 to 3, transmit-data-empty and receive-data-full interrupts from sci channel 0, and external request signals.
section 8 dma controller rev. 3.00 sep 27, 2006 page 224 of 872 rej09b0325-0300 for the detailed settings see section 8.2.4, data transfer control registers (dtcr). figure 8.3 shows a sample setup procedure for i/o mode. set source and destination addresses set transfer count read dtcr set dtcr i/o mode i/o mode setup 1 2 3 4 1. 2. 3. 4. set the source and destination addresses in mar and ioar. the transfer direction is determined automatically from the activation source. set the transfer count in etcr. read dtcr while the dte bit is cleared to 0. set the dtcr bits as follows. select the dmac activation source with bits dts2 to dts0. set or clear the dtie bit to enable or disable the cpu interrupt at the end of the transfer. clear the rpe bit to 0 to select i/o mode. select mar increment or decrement with the dtid bit. select byte size or word size with the dtsz bit. set the dte bit to 1 to enable the transfer.       figure 8.3 i/o mode setup procedure (example) 8.4.3 idle mode idle mode can be selected independently for each channel. one byte or word is transferred at each transfer request in idle mode. a designated number of these transfers are executed. one address is specified in the memory address register (mar), the other in the i/o address register (ioar). the direction of transfer is determined automatically from the activation source. the transfer is from the address specified in ioar to the address specified in mar if activated by an sci channel 0 receive-data-full interrupt, and from the address specified in mar to the address specified in ioar otherwise. table 8.7 indicates the register functions in idle mode.
section 8 dma controller rev. 3.00 sep 27, 2006 page 225 of 872 rej09b0325-0300 table 8.7 register functions in idle mode function register activated by sci0 receive- data-full interrupt other activation initial setting operation 23 0 mar destination address register source address register destination or source address held fixed all 1s ioar 23 0 7 source address register destination address register source or destination address held fixed 15 0 etcr transfer counter transfer counter number of transfers decremented once per transfer until h'0000 is reached and transfer ends legend: mar: memory address register ioar: i/o address register etcr: execute transfer count register mar and ioar specify the source and destination addresses. mar specifies a 24-bit source or destination address. ioar specifies the lower 8 bits of a fixed address. the upper 16 bits are all 1s. mar and ioar are not incremented or decremented. figure 8.4 illustrates how idle mode operates. transfer 1 byte or word is transferred per request ioar mar figure 8.4 operation in idle mode
section 8 dma controller rev. 3.00 sep 27, 2006 page 226 of 872 rej09b0325-0300 the transfer count is specified as a 16-bit value in etcr. the etcr value is decremented by 1 at each transfer. when the etcr value reaches h'0000, the dte bit is cleared, the transfer ends, and a cpu interrupt is requested. the maximum transfer count is 65,536, obtained by setting etcr to h'0000. transfers can be requested (activated) by compare match/input capture a interrupts from itu channels 0 to 3, transmit-data-empty and receive-data-full interrupts from sci channel 0, and external request signals. for the detailed settings see section 8.2.4, data transfer control registers (dtcr). figure 8.5 shows a sample setup procedure for idle mode. set source and destination addresses set transfer count read dtcr set dtcr idle mode idle mode setup 1 2 3 4 1. 2. 3. 4. set the source and destination addresses in mar and ioar. the transfer direction is deter- mined automatically from the activation source. set the transfer count in etcr. read dtcr while the dte bit is cleared to 0. set the dtcr bits as follows. select the dmac activation source with bits dts2 to dts0. set the dtie and rpe bits to 1 to select idle mode. select byte size or word size with the dtsz bit. set the dte bit to 1 to enable the transfer.     figure 8.5 idle mode setup procedure (example)
section 8 dma controller rev. 3.00 sep 27, 2006 page 227 of 872 rej09b0325-0300 8.4.4 repeat mode repeat mode is useful for cyclically transferring a bit pattern from a table to the programmable timing pattern controller (tpc) in synchronization, for example, with itu compare match. repeat mode can be selected for each channel independently. one byte or word is transferred per request in repeat mode, as in i/o mode. a designated number of these transfers are executed. one address is specified in the memory address register (mar), the other in the i/o address register (ioar). at the end of the designated number of transfers, mar and etcr are restored to their original values and operation continues. the direction of transfer is determined automatically from the activation source. the transfer is from the address specified in ioar to the address specified in mar if activated by an sci channel 0 receive-data- full interrupt, and from the address specified in mar to the address specified in ioar otherwise. table 8.8 indicates the register functions in repeat mode.
section 8 dma controller rev. 3.00 sep 27, 2006 page 228 of 872 rej09b0325-0300 table 8.8 register functions in repeat mode function register activated by sci0 receive- data-full interrupt other activation initial setting operation 23 0 mar destination address register source address register destination or source address incremented or decremented at each transfer until h'0000, then restored to initial value all 1s ioar 23 0 7 source address register destination address register source or destination address held fixed transfer counter transfer counter number of transfers decremented once per transfer until h'0000 is reached, then reloaded from etcrl 70 etcrh 70 etcrl initial transfer count initial transfer count number of transfers held fixed legend: mar: memory address register ioar: i/o address register etcr: execute transfer count register in repeat mode etcrh is used as the transfer counter while etcrl holds the initial transfer count. etcrh is decremented by 1 at each transfer until it reaches h'00, then is reloaded from etcrl. mar is also restored to its initial value, which is calculated from the dtsz and dtid bits in dtcr. specifically, mar is restored as follows: mar mar ? (?1) dtid 2 dtsz etcrl etcrh and etcrl should be initially set to the same value. in repeat mode transfers continue until the cpu clears the dte bit to 0. after dte is cleared to 0, if the cpu sets dte to 1 again, transfers resume from the state at which dte was cleared. no cpu interrupt is requested.
section 8 dma controller rev. 3.00 sep 27, 2006 page 229 of 872 rej09b0325-0300 as in i/o mode, mar and ioar specify the source and destination addresses. mar specifies a 24-bit source or destination address. ioar specifies the lower 8 bits of a fixed address. the upper 16 bits are all 1s. ioar is not incremented or decremented. figure 8.6 illustrates how repeat mode operates. address t address b transfer 1 byte or word is transferred per request legend: l = initial setting of mar n = initial setting of etcrh and etcrl address t = l address b = l + ( ?  (2 dtsz  n ? figure 8.6 operation in repeat mode the transfer count is specified as an 8-bit value in etcrh and etcrl. the maximum transfer count is 255, obtained by setting both etcrh and etcrl to h'ff. transfers can be requested (activated) by compare match/input capture a interrupts from itu channels 0 to 3, transmit-data-empty and receive-data-full interrupts from sci channel 0, and external request signals. for the detailed settings see section 8.2.4, data transfer control registers (dtcr).
section 8 dma controller rev. 3.00 sep 27, 2006 page 230 of 872 rej09b0325-0300 figure 8.7 shows a sample setup procedure for repeat mode. set source and destination addresses set transfer count read dtcr set dtcr repeat mode repeat mode 1 2 3 4 1. 2. 3. 4. set the source and destination addresses in mar and ioar. the transfer direction is determined automatically from the activation source. set the transfer count in both etcrh and etcrl. read dtcr while the dte bit is cleared to 0. set the dtcr bits as follows.      select the dmac activation source with bits dts2 to dts0. clear the dtie bit to 0 and set the rpe bit to 1 to select repeat mode. select mar increment or decrement with the dtid bit. select byte size or word size with the dtsz bit. set the dte bit to 1 to enable the transfer. figure 8.7 repeat mode setup procedure (example)
section 8 dma controller rev. 3.00 sep 27, 2006 page 231 of 872 rej09b0325-0300 8.4.5 normal mode in normal mode the a and b channels are combined. one byte or word is transferred per request. a designated number of these transfers are executed. addresses are specified in mara and marb. table 8.9 indicates the register functions in i/o mode. table 8.9 register functions in normal mode register function initial setting operation 23 0 mara source address register source address incremented or decremented once per transfer, or held fixed 23 0 marb destination address register destination address incremented or decremented once per transfer, or held fixed 15 0 etcra transfer counter number of transfers decremented once per transfer legend: mara: memory address register a marb: memory address register b etcra: execute transfer count register a the source and destination addresses are both 24-bit addresses. mara specifies the source address. marb specifies the destination address. mara and marb can be independently incremented, decremented, or held fixed as data is transferred. the transfer count is specified as a 16-bit value in etcra. the etcra value is decremented by 1 at each transfer. when the etcra value reaches h'0000, the dte bit is cleared and the transfer ends. if the dtie bit is set, a cpu interrupt is requested at this time. the maximum transfer count is 65,536, obtained by setting etcra to h'0000. figure 8.8 illustrates how normal mode operates.
section 8 dma controller rev. 3.00 sep 27, 2006 page 232 of 872 rej09b0325-0300 address t address b transfer legend: l l n t b t b address t address b a b a a b b = initial setting of mara = initial setting of marb = initial setting of etcra = l = l + saide  ( ?  (2 dtsz  n ?  ( ?  (2 dtsz  n ? figure 8.8 operation in normal mode transfers can be requested (activated) by an external request or auto-request. an auto-requested transfer is activated by the register settings alone. the designated number of transfers are executed automatically. either cycle-steal or burst mode can be selected. in cycle-steal mode the dmac releases the bus temporarily after each transfer. in burst mode the dmac keeps the bus until the transfers are completed, unless there is a bus request from a higher-priority bus master. for the detailed settings see section 8.3.4, data transfer control registers (dtcr).
section 8 dma controller rev. 3.00 sep 27, 2006 page 233 of 872 rej09b0325-0300 figure 8.9 shows a sample setup procedure for normal mode. 1. 2. 3. 4. 5. 6. 7. 8. 9. set the initial source address in mara. set the initial destination address in marb. set the transfer count in etcra. set the dtcrb bits as follows. set the dtcra bits as follows. read dtcrb with dtme cleared to 0. normal mode normal mode set initial source address set initial destination address set transfer count set dtcrb (1) set dtcra (1) read dtcrb set dtcrb (2) read dtcra set dtcra (2) 1 2 3 4 5 6 7 8 9         clear the dtme bit to 0. set the daid and daide bits to select whether marb is incremented, decremented, or held fixed. select the dmac activation source with bits dts2b to dts0b. clear the dte bit to 0. select byte or word size with the dtsz bit. set the said and saide bits to select whether mara is incremented, decremented, or held fixed. set or clear the dtie bit to enable or disable the cpu interrupt at the end of the transfer. clear the dts0a bit to 0 and set the dts2a and dts1a bits to 1 to select normal mode. set the dtme bit to 1 in dtcrb. read dtcra with dte cleared to 0. set the dte bit to 1 in dtcra to enable the transfer. note: carry out settings 1 to 9 with the dend interrupt masked in the cpu. if an nmi interrupt occurs during the setup procedure, it may clear the dtme bit to 0, in which case the transfer will not start. figure 8.9 normal mode setup procedure (example)
section 8 dma controller rev. 3.00 sep 27, 2006 page 234 of 872 rej09b0325-0300 8.4.6 block transfer mode in block transfer mode the a and b channels are combined. one block of a specified size is transferred per request. a designated number of block transfers are executed. addresses are specified in mara and marb. the block area address can be either held fixed or cycled. table 8.10 indicates the register functions in block transfer mode. table 8.10 register functions in block transfer mode register function initial setting operation 23 0 mara source address register source address incremented or decremented once per transfer, or held fixed 23 0 marb destination address register destination address incremented or decremented once per transfer, or held fixed block size counter block size decremented once per transfer until h'00 is reached, then reloaded from etcral 70 etcrah 70 etcral initial block size block size held fixed 15 0 etcrb block transfer counter number of block transfers decremented once per block transfer until h'0000 is reached and the transfer ends legend: mara: memory address register a marb: memory address register b etcra: execute transfer count register a etcrb: execute transfer count register b the source and destination addresses are both 24-bit addresses. mara specifies the source address. marb specifies the destination address. mara and marb can be independently incremented, decremented, or held fixed as data is transferred. one of these registers operates as a block area register: even if it is incremented or decremented, it is restored to its initial value at the end of each block transfer. the tms bit in dtcrb selects whether the block area is the source or destination.
section 8 dma controller rev. 3.00 sep 27, 2006 page 235 of 872 rej09b0325-0300 if m (1 to 255) is the size of the block transferred at each request and n (1 to 65,536) is the number of blocks to be transferred, then etcrah and etcral should initially be set to m and etcrb should initially be set to n. figure 8.10 illustrates how block transfer mode operates. in this figure, bit tms is cleared to 0, meaning the block area is the destination. t b transfer legend: l l m n t b t b address t m bytes or words are transferred per request address b a a block 1 block n b b block area block 2 = initial setting of mara = initial setting of marb = initial setting of etcrah and etcral = initial setting of etcrb = l = l + saide  ( ?  (2 dtsz  m ?  ( ?  (2 dtsz  m ? figure 8.10 operation in block transfer mode
section 8 dma controller rev. 3.00 sep 27, 2006 page 236 of 872 rej09b0325-0300 when activated by a transfer request, the dmac executes a burst transfer. during the transfer mara and marb are updated according to the dtcr settings, and etcrah is decremented. when etcrah reaches h'00, it is reloaded from etcral to restore the initial value. the memory address register of the block area is also restored to its initial value, and etcrb is decremented. if etcrb is not h'0000, the dmac then waits for the next transfer request. etcrah and etcral should be initially set to the same value. the above operation is repeated until etcrb reaches h'0000, at which point the dte bit is cleared to 0 and the transfer ends. if the dtie bit is set to 1, a cpu interrupt is requested at this time. figure 8.11 shows examples of a block transfer with byte data size when the block area is the destination. in (a) the block area address is cycled. in (b) the block area address is held fixed. transfers can be requested (activated) by compare match/input capture a interrupts from itu channels 0 to 3, and by external request signals. for the detailed settings see section 8.3.4, data transfer control registers (dtcr).
section 8 dma controller rev. 3.00 sep 27, 2006 page 237 of 872 rej09b0325-0300 start (dte = dtme = 1) transfer requested? get bus mara = mara + 1 read from mara address write to marb address marb = marb + 1 etcrah = etcrah ? ? ? ? ? figure 8.11 block transfer mode flowcharts (examples)
section 8 dma controller rev. 3.00 sep 27, 2006 page 238 of 872 rej09b0325-0300 figure 8.12 shows a sample setup procedure for block transfer mode. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. block transfer mode 1 2 3 4 5 6 7 8 9 10 set source address set destination address set block transfer count set block size set dtcrb (1) set dtcra (1) read dtcrb set dtcrb (2) read dtcra set dtcra (2) block transfer mode set the source address in mara. set the destination address in marb. set the block transfer count in etcrb. set the block size (number of bytes or words) in both etcrah and etcral. set the dtcrb bits as follows. set the dtcra bits as follows.          clear the dtme bit to 0. set the daid and daide bits to select whether marb is incremented, decremented, or held fixed. set or clear the tms bit to make the block area the source or destination. select the dmac activation source with bits dts2b to dts0b. clear the dte to 0. select byte size or word size with the dtsz bit. set the said and saide bits to select whether mara is incremented, decremented, or held fixed. set or clear the dtie bit to enable or disable the cpu interrupt at the end of the transfer. set bits dts2a to dts0a all to 1 to select block transfer mode. read dtcrb with dtme cleared to 0. set the dtme bit to 1 in dtcrb. read dtcra with dte cleared to 0. set the dte bit to 1 in dtcra to enable the transfer. note: carry out settings 1 to 10 with the dend interrupt masked in the cpu. if an nmi interrupt occurs during the setup procedure, it may clear the dtme bit to 0, in which case the transfer will not start. figure 8.12 block transfer mode setup procedure (example)
section 8 dma controller rev. 3.00 sep 27, 2006 page 239 of 872 rej09b0325-0300 8.4.7 dmac activation the dmac can be activated by an internal interrupt, external request, or auto-request. the available activation sources differ depending on the transfer mode and channel as indicated in table 8.11. table 8.11 dmac activation sources short address mode full address mode activation source channels 0a and 1a channels 0b and 1b normal block imia0 yes yes no yes imia1 yes yes no yes imia2 yes yes no yes imia3 yes yes no yes txi0 yes yes no no internal interrupts rxi0 yes yes no no falling edge of dreq no yes yes yes external requests low input at dreq no yes yes no auto-request no no yes no activation by internal interrupts when an interrupt request is selected as a dmac activation source and the dte bit is set to 1, that interrupt request is not sent to the cpu. it is not possible for an interrupt request to activate the dmac and simultaneously generate a cpu interrupt. when the dmac is activated by an interrupt request, the interrupt request flag is cleared automatically. if the same interrupt is selected to activate two or more channels, the interrupt request flag is cleared when the highest-priority channel is activated, but the transfer request is held pending on the other channels in the dmac, which are activated in their priority order.
section 8 dma controller rev. 3.00 sep 27, 2006 page 240 of 872 rej09b0325-0300 activation by external request if an external request ( dreq pin) is selected as an activation source, the dreq pin becomes an input pin and the corresponding tend pin becomes an output pin, regardless of the port data direction register (ddr) settings. the dreq input can be level-sensitive or edge-sensitive. in short address mode and normal mode, an external request operates as follows. if edge sensing is selected, one byte or word is transferred each time a high-to-low transition of the dreq input is detected. if the next edge is input before the transfer is completed, the next transfer may not be executed. if level sensing is selected, the transfer continues while dreq is low, until the transfer is completed. the bus is released temporarily after each byte or word has been transferred, however. if the dreq input goes high during a transfer, the transfer is suspended after the current byte or word has been transferred. when dreq goes low, the request is held internally until one byte or word has been transferred. the tend signal goes low during the last write cycle. in block transfer mode, an external request operates as follows. only edge-sensitive transfer requests are possible in block transfer mode. each time a high-to-low transition of the dreq input is detected, a block of the specified size is transferred. the tend signal goes low during the last write cycle in each block. activation by auto-request the transfer starts as soon as enabled by register setup, and continues until completed. cycle-steal mode or burst mode can be selected. in cycle-steal mode the dmac releases the bus temporarily after transferring each byte or word. normally, dmac cycles alternate with cpu cycles. in burst mode the dmac keeps the bus until the transfer is completed, unless there is a higher- priority bus request. if there is a higher-priority bus request, the bus is released after the current byte or word has been transferred.
section 8 dma controller rev. 3.00 sep 27, 2006 page 241 of 872 rej09b0325-0300 8.4.8 dmac bus cycle figure 8.13 shows an example of the timing of the basic dmac bus cycle. this example shows a word-size transfer from a 16-bit two-state access area to an 8-bit three-state access area. when the dmac gets the bus from the cpu, after one dead cycle (t d ), it reads from the source address and writes to the destination address. during these read and write operations the bus is not released even if there is another bus request. dmac cycles comply with bus controller settings in the same way as cpu cycles. rd hwr lwr t 1 t 2 t 1 t 2 t d t 1 t 2 t 1 t 2 t 3 t 1 t 2 t 3 t 1 t 2 t 1 t 2 cpu cycle dmac cycle (word transfer) cpu cycle source address destination address address bus figure 8.13 dma transfer bus timing (example)
section 8 dma controller rev. 3.00 sep 27, 2006 page 242 of 872 rej09b0325-0300 figure 8.14 shows the timing when the dmac is activated by low input at a dreq pin. this example shows a word-size transfer from a 16-bit two-state access area to another 16-bit two-state access area. the dmac continues the transfer while the dreq pin is held low. dreq rd hwr tend t 1 t 2 t 3 t d t 1 t 2 t 1 t 2 t 1 t 2 t d t 1 t 2 t 1 t 2 t 1 t 2 lwr , cpu cycle dmac cycle cpu cycle dmac cycle (last transfer cycle) cpu cycle source address destination address source address destination address address bus figure 8.14 bus timing of dma transfer requested by low dreq dreq dreq dreq input
section 8 dma controller rev. 3.00 sep 27, 2006 page 243 of 872 rej09b0325-0300 figure 8.15 shows an auto-requested burst-mode transfer. this example shows a transfer of three words from a 16-bit two-state access area to another 16-bit two-state access area. t 1 t 2 t 1 t 2 t 1 t 2 t 1 t 2 t 1 t 2 t 1 t 2 t 1 t 2 t 1 t 2 rd , cpu cycle dmac cycle source address destination address cpu cycle t d address bus hwr lwr figure 8.15 bus timing of burst mode dma transfer when the dmac is activated from a dreq pin there is a minimum interval of four states from when the transfer is requested until the dmac starts operating. the dreq pin is not sampled during the time between the transfer request and the start of the transfer. in short address mode and normal mode, the pin is next sampled at the end of the read cycle. in block transfer mode, the pin is next sampled at the end of one block transfer.
section 8 dma controller rev. 3.00 sep 27, 2006 page 244 of 872 rej09b0325-0300 figure 8.16 shows the timing when the dmac is activated by the falling edge of dreq in normal mode. dreq rd hwr , lwr figure 8.16 timing of dmac activation by falling edge of dreq dreq dreq dreq in normal mode
section 8 dma controller rev. 3.00 sep 27, 2006 page 245 of 872 rej09b0325-0300 figure 8.17 shows the timing when the dmac is activated by level-sensitive low dreq input in normal mode. dreq rd hwr lwr , t 2 t 1 t 2 t 1 t 2 t d t 1 t 2 t 1 t 2 t 1 t 2 t 1 t 2 t 1 cpu cycle dmac cycle cpu cycle minimum 4 states next sampling point address bus figure 8.17 timing of dmac activation by low dreq dreq dreq dreq level in normal mode
section 8 dma controller rev. 3.00 sep 27, 2006 page 246 of 872 rej09b0325-0300 figure 8.18 shows the timing when the dmac is activated by the falling edge of dreq in block transfer mode. dreq rd hwr tend t 1 t 2 t 1 t 2 t 1 t 2 t 1 t 2 t 1 t 2 t 1 t 2 t d t 1 t 2 dmac cycle dmac cycle cpu cycle next sampling minimum 4 states end of 1 block transfer lwr , address bus figure 8.18 timing of dmac activation by falling edge of dreq dreq dreq dreq in block transfer mode
section 8 dma controller rev. 3.00 sep 27, 2006 page 247 of 872 rej09b0325-0300 8.4.9 dmac multiple-channel operation the dmac channel priority order is: channel 0 > channel 1 and channel a > channel b. table 8.12 shows the complete priority order. table 8.12 channel priority order short address mode full address mode priority channel 0a channel 0 high channel 0b channel 1a channel 1 channel 1b low if transfers are requested on two or more channels simultaneously, or if a transfer on one channel is requested during a transfer on another channel, the dmac operates as follows. 1. when a transfer is requested, the dmac requests the bus right. when it gets the bus right, it starts a transfer on the highest-priority channel at that time. 2. once a transfer starts on one channel, requests to other channels are held pending until that channel releases the bus. 3. after each transfer in short address mode, and each externally-requested or cycle-steal transfer in normal mode, the dmac releases the bus and returns to step 1. after releasing the bus, if there is a transfer request for another channel, the dmac requests the bus again. 4. after completion of a burst-mode transfer, or after transfer of one block in block transfer mode, the dmac releases the bus and returns to step 1. if there is a transfer request for a higher-priority channel or a bus request from a higher-priority bus master, however, the dmac releases the bus after completing the transfer of the current byte or word. after releasing the bus, if there is a transfer request for another channel, the dmac requests the bus again. figure 8.19 shows the timing when channel 0a is set up for i/o mode and channel 1 for burst mode, and a transfer request for channel 0a is received while channel 1 is active.
section 8 dma controller rev. 3.00 sep 27, 2006 page 248 of 872 rej09b0325-0300 rd t 1 t 2 t 1 t 2 t d t 1 t 2 t 1 t 2 t 1 t 2 t d t 1 t 2 t 1 t 2 , dmac cycle (channel 1) cpu cycle dmac cycle (channel 0a) cpu cycle dmac cycle (channel 1) address bus hwr lwr figure 8.19 timing of multiple-channel operations 8.4.10 external bus requests, refresh controller, and dmac during a dma transfer, if the bus right is requested by an external bus request signal ( breq ) or by the refresh controller, the dmac releases the bus after completing the transfer of the current byte or word. if there is a transfer request at this point, the dmac requests the bus right again. figure 8.20 shows an example of the timing of insertion of a refresh cycle during a burst transfer on channel 0. rd hwr lwr , t 1 t 2 t 1 t 2 t 1 t 2 t 1 t 2 t 1 t 2 t d t 1 t 2 t 1 t 2 t 1 t 2 dmac cycle (channel 0) dmac cycle (channel 0) refresh cycle address bus figure 8.20 bus timing of refresh controller and dmac
section 8 dma controller rev. 3.00 sep 27, 2006 page 249 of 872 rej09b0325-0300 8.4.11 nmi interrupts and dmac nmi interrupts do not affect dmac operations in short address mode. if an nmi interrupt occurs during a transfer in full address mode, the dmac suspends operations. in full address mode, a channel is enabled when its dte and dtme bits are both set to 1. nmi input clears the dtme bit to 0. after transferring the current byte or word, the dmac releases the bus to the cpu. in normal mode, the suspended transfer resumes when the cpu sets the dtme bit to 1 again. check that the dte bit is set to 1 and the dtme bit is cleared to 0 before setting the dtme bit to 1. figure 8.21 shows the procedure for resuming a dma transfer in normal mode on channel 0 after the transfer was halted by nmi input. resuming dma transfer in normal mode dte = 1 dtme = 0 set dtme to 1 dma transfer continues end 1. 2. check that dte = 1 and dtme = 0. read dtcrb while dtme = 0, then write 1 in the dtme bit. 2 no yes 1 figure 8.21 procedure for resuming a dma transfer halted by nmi (example) for information about nmi interrupts in block transfer mode, see section 8.6.6, nmi interrupts and block transfer mode.
section 8 dma controller rev. 3.00 sep 27, 2006 page 250 of 872 rej09b0325-0300 8.4.12 aborting a dma transfer when the dte bit in an active channel is cleared to 0, the dmac halts after transferring the current byte or word. the dmac starts again when the dte bit is set to 1. in full address mode, the dtme bit can be used for the same purpose. figure 8.22 shows the procedure for aborting a dma transfer by software. dma transfer abort set dtcr dma transfer aborted 1 1. clear the dte bit to 0 in dtcr. to avoid generating an interrupt when aborting a dma transfer, clear the dtie bit to 0 simultaneously. figure 8.22 procedure for aborting a dma transfer
section 8 dma controller rev. 3.00 sep 27, 2006 page 251 of 872 rej09b0325-0300 8.4.13 exiting full address mode figure 8.23 shows the procedure for exiting full address mode and initializing the pair of channels. to set the channels up in another mode after exiting full address mode, follow the setup procedure for the relevant mode. exiting full address mode halt the channel initialize dtcrb initialize dtcra initialized and halted 1 2 3 1. 2. 3. clear the dte bit to 0 in dtcra, or wait for the transfer to end and the dte bit to be cleared to 0. clear all dtcrb bits to 0. clear all dtcra bits to 0. figure 8.23 procedure for exiting full address mode (example)
section 8 dma controller rev. 3.00 sep 27, 2006 page 252 of 872 rej09b0325-0300 8.4.14 dmac states in reset state, standby modes, and sleep mode when the chip is reset or enters hardware or software standby mode, the dmac is initialized and halts. dmac operations continue in sleep mode. figure 8.24 shows the timing of a cycle-steal transfer in sleep mode. rd hwr lwr , 2 t d t t 2 1 t 2 t d t 1 t 2 t 1 t 2 t 1 t cpu cycle dmac cycle dmac cycle sleep mode d t figure 8.24 timing of cycle-steal transfer in sleep mode
section 8 dma controller rev. 3.00 sep 27, 2006 page 253 of 872 rej09b0325-0300 8.5 interrupts the dmac generates only dma-end interrupts. table 8.13 lists the interrupts and their priority. table 8.13 dmac interrupts description interrupt short address mode full address mode interrupt priority dend0a end of transfer on channel 0a end of transfer on channel 0 high dend0b end of transfer on channel 0b ? dend1a end of transfer on channel 1a end of transfer on channel 1 dend1b end of transfer on channel 1b ? low each interrupt is enabled or disabled by the dtie bit in the corresponding data transfer control register (dtcr). separate interrupt signals are sent to the interrupt controller. the interrupt priority order among channels is channel 0 > channel 1 and channel a > channel b. figure 8.25 shows the dma-end interrupt logic. an interrupt is requested whenever dte = 0 and dtie = 1. dte dtie dma-end interrupt figure 8.25 dma-end interrupt logic the dma-end interrupt for the b channels (dendb) is unavailable in full address mode. the dtme bit does not affect interrupt operations.
section 8 dma controller rev. 3.00 sep 27, 2006 page 254 of 872 rej09b0325-0300 8.6 usage notes 8.6.1 note on word data transfer word data cannot be accessed starting at an odd address. when word-size transfer is selected, set even values in the memory and i/o address registers (mar and ioar). 8.6.2 dmac self-access the dmac itself cannot be accessed during a dmac cycle. dmac registers cannot be specified as source or destination addresses. 8.6.3 longword access to memory address registers a memory address register can be accessed as longword data at the marr address. example: mov.l #lbl, er0 mov.l er0, @marr four byte accesses are performed. note that the cpu may release the bus between the second byte (mare) and third byte (marh). memory address registers should be written and read only when the dmac is halted. 8.6.4 note on full address mode setup full address mode is controlled by two registers: dtcra and dtcrb. care must be taken to prevent the b channel from operating in short address mode during the register setup. the enable bits (dte and dtme) should not be set to 1 until the end of the setup procedure. 8.6.5 note on activating dmac by internal interrupts when using an internal interrupt to activate the dmac, make sure that the interrupt selected as the activating source does not occur during the interval after it has been selected but before the dmac has been enabled. the on-chip supporting module that will generate the interrupt should not be activated until the dmac has been enabled. if the dmac must be enabled while the on- chip supporting module is active, follow the procedure in figure 8.26.
section 8 dma controller rev. 3.00 sep 27, 2006 page 255 of 872 rej09b0325-0300 enabling of dmac selected interrupt requested? interrupt hand- ling by cpu clear selected interrupt ? s enable bit to 0 enable dmac set selected interrupt ? s enable bit to 1 1 2 3 4 1. 2. 3. 4. while the dte bit is cleared to 0, interrupt requests are sent to the cpu. clear the interrupt enable bit to 0 in the interrupt-generating on-chip supporting module. enable the dmac. enable the dmac-activating interrupt. dmac operates yes no figure 8.26 procedure for enabling dmac while on-chip supporting module is operating (example) if the dte bit is set to 1 but the dtme bit is cleared to 0, the dmac is halted and the selected activating source cannot generate a cpu interrupt. if the dmac is halted by an nmi interrupt, for example, the selected activating source cannot generate cpu interrupts. to terminate dmac operations in this state, clear the dte bit to 0 to allow cpu interrupts to be requested. to continue dmac operations, carry out steps 2 and 4 in figure 8.26 before and after setting the dtme bit to 1. when an itu interrupt activates the dmac, make sure the next interrupt does not occur before the dma transfer ends. if one itu interrupt activates two or more channels, make sure the next interrupt does not occur before the dma transfers end on all the activated channels. if the next interrupt occurs before a transfer ends, the channel or channels for which that interrupt was selected may fail to accept further activation requests.
section 8 dma controller rev. 3.00 sep 27, 2006 page 256 of 872 rej09b0325-0300 8.6.6 nmi interrupts and block transfer mode if an nmi interrupt occurs in block transfer mode, the dmac operates as follows. 1. when the nmi interrupt occurs, the dmac finishes transferring the current byte or word, then clears the dtme bit to 0 and halts. the halt may occur in the middle of a block. it is possible to find whether a transfer was halted in the middle of a block by checking the block size counter. if the block size counter does not have its initial value, the transfer was halted in the middle of a block. 2. if the transfer is halted in the middle of a block, the activating interrupt flag is cleared to 0. the activation request is not held pending. 3. while the dte bit is set to 1 and the dtme bit is cleared to 0, the dmac is halted and does not accept activating interrupt requests. if an activating interrupt occurs in this state, the dmac does not operate and does not hold the transfer request pending internally. neither is a cpu interrupt requested. for this reason, before setting the dtme bit to 1, first clear the enable bit of the activating interrupt to 0. then, after setting the dtme bit to 1, set the interrupt enable bit to 1 again. see section 8.6.5, note on activating dmac by internal interrupts. 4. when the dtme bit is set to 1, the dmac waits for the next transfer request. if it was halted in the middle of a block transfer, the rest of the block is transferred when the next transfer request occurs. otherwise, the next block is transferred when the next transfer request occurs. 8.6.7 memory and i/o address register values table 8.14 indicates the address ranges that can be specified in the memory and i/o address registers (mar and ioar). table 8.14 address ranges specifiable in mar and ioar 1-mbyte mode 16-mbyte mode mar h'00000 to h'fffff (0 to 1048575) h'000000 to h'ffffff (0 to 16777215) ioar h'fff00 to h'fffff (1048320 to 1048575) h'ffff00 to h'ffffff (16776960 to 16777215) mar bits 23 to 20 are ignored in 1-mbyte mode.
section 8 dma controller rev. 3.00 sep 27, 2006 page 257 of 872 rej09b0325-0300 8.6.8 bus cycle when transfer is aborted when a transfer is aborted by clearing the dte bit or suspended by an nmi that clears the dtme bit, if this halts a channel for which the dmac has a transfer request pending internally, a dead cycle may occur. this dead cycle does not update the halted channel?s address register or counter value. figure 8.27 shows an example in which an auto-requested transfer in cycle-steal mode on channel 0 is aborted by clearing the dte bit in channel 0. rd hwr , lwr cpu cycle dmac cycle cpu cycle dmac cycle cpu cycle dte bit is cleared t 1 t 2 t d t 1 t 2 t 1 t 2 t 1 t 2 t 3 t d t d t 1 t 2 figure 8.27 bus timing at abort of dma transfer in cycle-steal mode
section 8 dma controller rev. 3.00 sep 27, 2006 page 258 of 872 rej09b0325-0300
section 9 i/o ports rev. 3.00 sep 27, 2006 page 259 of 872 rej09b0325-0300 section 9 i/o ports 9.1 overview the h8/3048b group has 10 input/output ports (ports 1, 2, 3, 4, 5, 6, 8, 9, a, and b) and one input port (port 7). table 9.1 summarizes the port functions. the pins in each port are multiplexed as shown in table 9.1. each port has a data direction register (ddr) for selecting input or output, and a data register (dr) for storing output data. in addition to these registers, ports 2, 4, and 5 have an input pull-up mos control register (pcr) for switching input pull-up mos transistors on and off. ports 1 to 6 and port 8 can drive one ttl load and a 90-pf capacitive load. ports 9, a, and b can drive one ttl load and a 30-pf capacitive load. ports 1 to 6 and 8 to b can drive a darlington pair. ports 1, 2, 5, and b can drive leds (with 10-ma current sink). pins p8 2 to p8 0 , pa 7 to pa 0 , and pb 3 to pb 0 have schmitt-trigger input circuits. for block diagrams of the ports see appendix c, i/o port block diagrams.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 260 of 872 rej09b0325-0300 table 9.1 port functions port description pins mode 1 mode 2 mode 3 mode 4 mode 5 mode 6 mode 7 port 1 ? 8-bit i/o port  can drive leds p1 7 to p1 0 / a 7 to a 0 address output pins (a 7 to a 0 ) address output (a 7 to a 0 ) and generic input ddr = 0: generic input ddr = 1: address output generic input/ output port 2  8-bit i/o port  input pull-up mos  can drive leds p2 7 to p2 0 / a 15 to a 8 address output pins (a 15 to a 8 ) address output (a 15 to a 8 ) and generic input ddr = 0: generic input ddr = 1: address output generic input/ output port 3  8-bit i/o port p3 7 to p3 0 / d 15 to d 8 data input/output (d 15 to d 8 ) generic input/ output port 4  8-bit i/o port  input pull-up mos p4 7 to p4 0 / d 7 to d 0 data input/output (d 7 to d 0 ) and 8-bit generic input/output 8-bit bus mode: generic input/output 16-bit bus mode: data input/output generic input/ output port 5  4-bit i/o port  input pull-up mos  can drive leds p5 3 to p5 0 / a 19 to a 16 address output (a 19 to a 16 ) address output (a 19 to a 16 ) and 4-bit generic input ddr = 0: generic input ddr = 1: address output generic input/ output p6 6 / lwr , p6 5 / hwr , p6 4 / rd , p6 3 / as bus control signal output ( lwr , hwr , rd , as ) port 6  7-bit i/o port p6 2 / back , p6 1 / breq , p6 0 / wait bus control signal input/output ( back , breq , wait ) and 3- bit generic input/output generic input/ output p7 7 /an 7 /da 1 , p7 6 /an 6 /da 0 analog input (an 7 , an 6 ) to a/d converter, analog output (da 1 , da 0 ) from d/a converter, and generic input port 7  8-bit i/o port p7 5 to p7 0 / an 5 to an 0 analog input (an 5 to an 0 ) to a/d converter, and generic input
section 9 i/o ports rev. 3.00 sep 27, 2006 page 261 of 872 rej09b0325-0300 port description pins mode 1 mode 2 mode 3 mode 4 mode 5 mode 6 mode 7 p8 4 / cs 0 ddr = 0: generic input ddr = 1 (after reset): cs 0 output generic input/ output p8 3 / cs 1 / irq 3 , p8 2 / c s 2 / ir q 2 , p8 1 / cs 3 / irq 1 irq 3 to irq 1 input, cs 1 to cs 3 output, and generic input ddr = 0 (after reset): generic input ddr = 1: cs 1 to cs 3 output port 8  5-bit i/o port p8 2 to p8 0 have schmitt inputs p8 0 / rfsh / irq 0 irq 0 input, rfsh output, and generic input/output irq 3 to irq 0 input and generic input/ output port 9  6-bit i/o port p9 5 /sck 1 / irq 5 , p9 4 /sck 0 / ir q 4 , p9 3 /rxd 1 , p9 2 /rxd 0 , p9 1 /txd 1 , p9 0 /txd 0 input and output (sck 1 , sck 0 , rxd 1 , rxd 0 , txd 1 , txd 0 ) for serial communication interfaces 1 and 0 (sci1/0), irq 5 and irq 4 input, and 6- bit generic input/output pa 7 /tp 7 / tiocb 2 /a 20 output (tp 7 ) from programmable timing pattern controller (tpc), input or output (tiocb 2 ) for 16-bit integrated timer unit (itu), and generic input/output address output (a 20 ) tpc output (tp 7 ), itu input or output (tiocb 2 ), and generic input/ output address output (a 20 ) tpc output (tp 7 ), itu input or output (tiocb 2 ), and generic input/ output port a  8-bit i/o port schmitt inputs pa 6 /tp 6 / tioca 2 /a 21 / cs 4 pa 5 /tp 5 / tiocb 1 /a 22 / cs 5 pa 4 /tp 4 / tioca 1 /a 23 / cs 6 tpc output (tp 6 to tp 4 ), itu input and output (tioca 2 , tiocb 1 , tioca 1 ), cs 4 to cs 6 output, and generic input/ output tpc output (tp 6 to tp 4 ), itu input and output (tioca 2 , tiocb 1 , tioca 1 ), address output (a 23 to a 21 ), cs 4 to cs 6 output, and generic input/output tpc output (tp 6 to tp 4 ), itu input and output (tioca 2 , tiocb 1 , tioca 1 ), cs 4 to cs 6 output, and generic input/ output tpc output (tp 6 to tp 4 ), itu input and output (tioca 2 , tiocb 1 , tioca 1 ), address output (a 23 to a 21 ), cs 4 to cs 6 output, and generic input/out put tpc output (tp 6 to tp 4 ), itu input and output (tioca 2 , tiocb 1 , tioca 1 ), and generic input/ output
section 9 i/o ports rev. 3.00 sep 27, 2006 page 262 of 872 rej09b0325-0300 port description pins mode 1 mode 2 mode 3 mode 4 mode 5 mode 6 mode 7 port a  8-bit i/o port schmitt inputs pa 3 /tp 3 / tiocb 0 / tclkd, pa 2 /tp 2 / tioca 0 / tclkc, pa 1 /tp 1 / tend 1 /tclkb, pa 0 /tp 0 / tend 0 /tclka tpc output (tp 3 to tp 0 ), output ( tend 1 , tend 0 ) from dma controller (dmac), itu input and output (tclkd, tclkc, tclkb, tclka, tiocb 0 , tioca 0 ), and generic input/output pb 7 /tp 15 / dre q 1 / adtr g tpc output (tp 15 ), dmac input ( dreq 1 ), trigger input ( adtrg ) to a/d converter, and generic input/output pb 6 /tp 14 / dreq 0 ,/ cs 7 tpc output (tp 14 ), dmac input ( dreq 0 ), cs 7 output, and generic input/output tpc output (tp 14 ), dmac input ( dreq 0 ), and generic input/ output port b  8-bit i/o port  can drive leds pb 3 to pb 0 have schmitt inputs pb 5 /tp 13 / tocxb 4 , pb 4 /tp 12 / tocxa 4 , pb 3 /tp 11 / tiocb 4 , pb 2 /tp 10 / tioca 4 , pb 1 /tp 9 / tiocb 3 , pb 0 /tp 8 / tioca 3 tpc output (tp 13 to tp 8 ), itu input and output (tocxb 4 , tocxa 4 , tiocb 4 , tioca 4 , tiocb 3 , tioca 3 ), and generic input/output
section 9 i/o ports rev. 3.00 sep 27, 2006 page 263 of 872 rej09b0325-0300 9.2 port 1 9.2.1 overview port 1 is an 8-bit input/output port with the pin configuration shown in figure 9.1. the pin functions differ between the expanded modes with on-chip rom disabled, expanded modes with on-chip rom enabled, and single-chip mode. in modes 1 to 4 (expanded modes with on-chip rom disabled), they are address bus output pins (a 7 to a 0 ). in modes 5 and 6 (expanded modes with on-chip rom enabled), settings in the port 1 data direction register (p1ddr) can designate pins for address bus output (a 7 to a 0 ) or generic input. in mode 7 (single-chip mode), port 1 is a generic input/output port. when dram is connected to area 3, a 7 to a 0 output row and column addresses in read and write cycles. for details see section 7, refresh controller. pins in port 1 can drive one ttl load and a 90-pf capacitive load. they can also drive a darlington transistor pair. port 1 p1 /a p1 /a p1 /a p1 /a p1 /a p1 /a p1 /a p1 /a 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 p1 (input/output) p1 (input/output) p1 (input/output) p1 (input/output) p1 (input/output) p1 (input/output) p1 (input/output) p1 (input/output) 7 6 5 4 3 2 1 0 a (output) a (output) a (output) a (output) a (output) a (output) a (output) a (output) 7 6 5 4 3 2 1 0 port 1 pins mode 7 modes 1 to 4 p1 (input)/a (output) p1 (input)/a (output) p1 (input)/a (output) p1 (input)/a (output) p1 (input)/a (output) p1 (input)/a (output) p1 (input)/a (output) p1 (input)/a (output) 7 6 5 4 3 2 1 0 modes 5 and 6 7 6 5 4 3 2 1 0 figure 9.1 port 1 pin configuration
section 9 i/o ports rev. 3.00 sep 27, 2006 page 264 of 872 rej09b0325-0300 9.2.2 register descriptions table 9.2 summarizes the registers of port 1. table 9.2 port 1 registers initial value address * name abbreviation r/w modes 1 to 4 modes 5 to 7 h'ffc0 port 1 data direction register p1ddr w h'ff h'00 h'ffc2 port 1 data register p1dr r/w h'00 h'00 note: * lower 16 bits of the address. port 1 data direction register (p1ddr) p1ddr is an 8-bit write-only register that can select input or output for each pin in port 1. bit modes 1 to 4 initial value read/write initial value read/write modes 5 to 7 7 p1 ddr 1 ? 0 w 7 6 p1 ddr 1 ? 0 w 6 5 p1 ddr 1 ? 0 w 5 4 p1 ddr 1 ? 0 w 4 3 p1 ddr 1 ? 0 w 3 2 p1 ddr 1 ? 0 w 2 1 p1 ddr 1 ? 0 w 1 0 p1 ddr 1 ? 0 w 0 port 1 data direction 7 to 0 these bits select input or output for port 1 pins modes 1 to 4 (expanded modes with on-chip rom disabled): p1ddr values are fixed at 1 and cannot be modified. port 1 functions as an address bus. modes 5 and 6 (expanded modes with on-chip rom enabled): a pin in port 1 becomes an address output pin if the corresponding p1ddr bit is set to 1, and a generic input pin if this bit is cleared to 0. mode 7 (single-chip mode): port 1 functions as an input/output port. a pin in port 1 becomes an output pin if the corresponding p1ddr bit is set to 1, and an input pin if this bit is cleared to 0. in modes 5 to 7, p1ddr is a write-only register. its value cannot be read. all bits return 1 when read.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 265 of 872 rej09b0325-0300 p1ddr is initialized to h'ff in modes 1 to 4 and h'00 in modes 5 to 7 by a reset and in hardware standby mode. in software standby mode it retains its previous setting. if a p1ddr bit is set to 1, the corresponding pin maintains its output state in software standby mode. port 1 data register (p1dr) p1dr is an 8-bit readable/writable register that stores output data for pins p1 7 to p1 0 . while port 1 acts as an output port, the value of this register is output. when a bit in p1ddr is set to 1, if port 1 is read the value of the corresponding p1dr bit is returned. when a bit in p1ddr is cleared to 0, if port 1 is read the corresponding pin level is read. bit initial value read/write 7 p1 0 r/w port 1 data 7 to 0 these bits store data for port 1 pins 7 6 p1 0 r/w 6 5 p1 0 r/w 5 4 p1 0 r/w 4 3 p1 0 r/w 3 2 p1 0 r/w 2 1 p1 0 r/w 1 0 p1 0 r/w 0 p1dr is initialized to h'00 by a reset and in hardware standby mode. in software standby mode it retains its previous setting.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 266 of 872 rej09b0325-0300 9.3 port 2 9.3.1 overview port 2 is an 8-bit input/output port with the pin configuration shown in figure 9.2. the pin functions differ according to the operating mode. in modes 1 to 4 (expanded modes with on-chip rom disabled), port 2 consists of address bus output pins (a 15 to a 8 ). in modes 5 and 6 (expanded modes with on-chip rom enabled), settings in the port 2 data direction register (p2ddr) can designate pins for address bus output (a 15 to a 8 ) or generic input. in mode 7 (single-chip mode), port 2 is a generic input/output port. when dram is connected to area 3, a 9 and a 8 output row and column addresses in read and write cycles. for details see section 7, refresh controller. port 2 has software-programmable built-in pull-up mos. pins in port 2 can drive one ttl load and a 90-pf capacitive load. they can also drive a darlington transistor pair. port 2 p2 /a p2 /a p2 /a p2 /a p2 /a p2 /a p2 /a p2 /a 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 p2 (input/output) p2 (input/output) p2 (input/output) p2 (input/output) p2 (input/output) p2 (input/output) p2 (input/output) p2 (input/output) 7 6 5 4 3 2 1 0 a (output) a (output) a (output) a (output) a (output) a (output) a (output) a (output) 15 14 13 12 11 10 9 8 port 2 pins mode 7 modes 1 to 4 p2 (input)/a (output) p2 (input)/a (output) p2 (input)/a (output) p2 (input)/a (output) p2 (input)/a (output) p2 (input)/a (output) p2 (input)/a (output) p2 (input)/a (output) 7 6 5 4 3 2 1 0 modes 5 and 6 15 14 13 12 11 10 9 8 figure 9.2 port 2 pin configuration
section 9 i/o ports rev. 3.00 sep 27, 2006 page 267 of 872 rej09b0325-0300 9.3.2 register descriptions table 9.3 summarizes the registers of port 2. table 9.3 port 2 registers initial value address * name abbreviation r/w modes 1 to 4 modes 5 to 7 h'ffc1 port 2 data direction register p2ddr w h'ff h'00 h'ffc3 port 2 data register p2dr r/w h'00 h'00 h'ffd8 port 2 input pull-up mos control register p2pcr r/w h'00 h'00 note: * lower 16 bits of the address. port 2 data direction register (p2ddr) p2ddr is an 8-bit write-only register that can select input or output for each pin in port 2. bit modes 1 to 4 initial value read/write initial value read/write modes 5 to 7 7 p2 ddr 1 ? 0 w 7 6 p2 ddr 1 ? 0 w 6 5 p2 ddr 1 ? 0 w 5 4 p2 ddr 1 ? 0 w 4 3 p2 ddr 1 ? 0 w 3 2 p2 ddr 1 ? 0 w 2 1 p2 ddr 1 ? 0 w 1 0 p2 ddr 1 ? 0 w 0 port 2 data direction 7 to 0 these bits select input or output for port 2 pins modes 1 to 4 (expanded modes with on-chip rom disabled): p2ddr values are fixed at 1 and cannot be modified. port 2 functions as an address bus. modes 5 and 6 (expanded modes with on-chip rom enabled): following a reset, port 2 is an input port. a pin in port 2 becomes an address output pin if the corresponding p2ddr bit is set to 1, and a generic input port if this bit is cleared to 0. mode 7 (single-chip mode): port 2 functions as an input/output port. a pin in port 2 becomes an output port if the corresponding p2ddr bit is set to 1, and an input port if this bit is cleared to 0. in modes 1 to 4, p2ddr always returns 1 when read. no value can be written to.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 268 of 872 rej09b0325-0300 in modes 5 to 7, p2ddr is a write-only register. its value cannot be read. all bits return 1 when read. p2ddr is initialized to h'ff in modes 1 to 4 and h'00 in modes 5 to 7 by a reset and in hardware standby mode. in software standby mode it retains its previous setting. if a p2ddr bit is set to 1, the corresponding pin maintains its output state in software standby mode. port 2 data register (p2dr) p2dr is an 8-bit readable/writable register that stores output data for pins p2 7 to p2 0 . while port 2 acts as an output port, the value of this register is output. when a bit in p2ddr is set to 1, if port 2 is read the value of the corresponding p2dr bit is returned. when a bit in p2ddr is cleared to 0, if port 2 is read the corresponding pin level is read. bit initial value read/write 7 p2 0 r/w port 2 data 7 to 0 these bits store data for port 2 pins 7 6 p2 0 r/w 6 5 p2 0 r/w 5 4 p2 0 r/w 4 3 p2 0 r/w 3 2 p2 0 r/w 2 1 p2 0 r/w 1 0 p2 0 r/w 0 p2dr is initialized to h'00 by a reset and in hardware standby mode. in software standby mode it retains its previous setting. port 2 input pull-up mos control register (p2pcr) p2pcr is an 8-bit readable/writable register that controls the mos input pull-up transistors in port 2. bit initial value read/write 7 p2 pcr 0 r/w port 2 input pull-up mos control 7 to 0 these bits control input pull-up transistors built into port 2 7 6 p2 pcr 0 r/w 6 5 p2 pcr 0 r/w 5 4 p2 pcr 0 r/w 4 3 p2 pcr 0 r/w 3 2 p2 pcr 0 r/w 2 1 p2 pcr 0 r/w 1 0 p2 pcr 0 r/w 0
section 9 i/o ports rev. 3.00 sep 27, 2006 page 269 of 872 rej09b0325-0300 in modes 5 to 7, when a p2ddr bit is cleared to 0 (selecting generic input), if the corresponding bit from p2 7 pcr to p2 0 pcr is set to 1, the input pull-up mos is turned on. p2pcr is initialized to h'00 by a reset and in hardware standby mode. in software standby mode it retains its previous setting. table 9.4 summarizes the states of the input pull-up transistors. table 9.4 input pull-up mos states (port 2) mode reset hardware standby mode software standby mode other modes 1 off off off off 2 3 4 5 off off on/off on/off 6 7 legend: off: the input pull-up mos is always off. on/off: the input pull-up mos is on if p2pcr = 1 and p2ddr = 0. otherwise, it is off.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 270 of 872 rej09b0325-0300 9.4 port 3 9.4.1 overview port 3 is an 8-bit input/output port with the pin configuration shown in figure 9.3. port 3 is a data bus in modes 1 to 6 (expanded modes) and a generic input/output port in mode 7 (single-chip mode). pins in port 3 can drive one ttl load and a 90-pf capacitive load. they can also drive a darlington transistor pair. port 3 p3 /d p3 /d p3 /d p3 /d p3 /d p3 /d p3 /d p3 /d 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 p3 (input/output) p3 (input/output) p3 (input/output) p3 (input/output) p3 (input/output) p3 (input/output) p3 (input/output) p3 (input/output) 7 6 5 4 3 2 1 0 d (input/output) d (input/output) d (input/output) d (input/output) d (input/output) d (input/output) d (input/output) d (input/output) 15 14 13 12 11 10 9 8 port 3 pins mode 7 modes 1 to 6 figure 9.3 port 3 pin configuration 9.4.2 register descriptions table 9.5 summarizes the registers of port 3. table 9.5 port 3 registers address * name abbreviation r/w initial value h'ffc4 port 3 data direction register p3ddr w h'00 h'ffc6 port 3 data register p3dr r/w h'00 note: * lower 16 bits of the address.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 271 of 872 rej09b0325-0300 port 3 data direction register (p3ddr) p3ddr is an 8-bit write-only register that can select input or output for each pin in port 3. bit initial value read/write 7 p3 ddr 0 w port 3 data direction 7 to 0 these bits select input or output for port 3 pins 7 6 p3 ddr 0 w 6 5 p3 ddr 0 w 5 4 p3 ddr 0 w 4 3 p3 ddr 0 w 3 2 p3 ddr 0 w 2 1 p3 ddr 0 w 1 0 p3 ddr 0 w 0 modes 1 to 6 (expanded modes): port 3 functions as a data bus. p3ddr is ignored. mode 7 (single-chip mode): port 3 functions as an input/output port. a pin in port 3 becomes an output port if the corresponding p3ddr bit is set to 1, and an input port if this bit is cleared to 0. p3ddr is a write-only register. its value cannot be read. all bits return 1 when read. p3ddr is initialized to h'00 by a reset and in hardware standby mode. in software standby mode it retains its previous setting. if a p3ddr bit is set to 1, the corresponding pin maintains its output state in software standby mode. port 3 data register (p3dr) p3dr is an 8-bit readable/writable register that stores output data for pins p3 7 to p3 0 . while port 3 acts as an output port, the value of this register is output. when a bit in p3ddr is set to 1, if port 3 is read the value of the corresponding p3dr bit is returned. when a bit in p3ddr is cleared to 0, if port 3 is read the corresponding pin level is read. bit initial value read/write 7 p3 0 r/w port 3 data 7 to 0 these bits store data for port 3 pins 7 6 p3 0 r/w 6 5 p3 0 r/w 5 4 p3 0 r/w 4 3 p3 0 r/w 3 2 p3 0 r/w 2 1 p3 0 r/w 1 0 p3 0 r/w 0 p3dr is initialized to h'00 by a reset and in hardware standby mode. in software standby mode it retains its previous setting.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 272 of 872 rej09b0325-0300 9.5 port 4 9.5.1 overview port 4 is an 8-bit input/output port with the pin configuration shown in figure 9.4. the pin functions differ according to the operating mode. in modes 1 to 6 (expanded modes), when the bus width control register (abwcr) designates areas 0 to 7 all as 8-bit-access areas, the chip operates in 8-bit bus mode and port 4 is a generic input/output port. when at least one of areas 0 to 7 is designated as a 16-bit-access area, the chip operates in 16-bit bus mode and port 4 becomes part of the data bus. in mode 7 (single-chip mode), port 4 is a generic input/output port. port 4 has software-programmable built-in pull-up mos. pins in port 4 can drive one ttl load and a 90-pf capacitive load. they can also drive a darlington transistor pair. port 4 p4 /d p4 /d p4 /d p4 /d p4 /d p4 /d p4 /d p4 /d 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 p4 (input/output)/d 7 (input/output) p4 (input/output)/d 6 (input/output) p4 (input/output)/d 5 (input/output) p4 (input/output)/d 4 (input/output) p4 (input/output)/d 3 (input/output) p4 (input/output)/d 2 (input/output) p4 (input/output)/d 1 (input/output) p4 (input/output)/d 0 (input/output) 7 6 5 4 3 2 1 0 port 4 pins modes 1 to 6 p4 (input/output) p4 (input/output) p4 (input/output) p4 (input/output) p4 (input/output) p4 (input/output) p4 (input/output) p4 (input/output) 7 6 5 4 3 2 1 0 mode 7 figure 9.4 port 4 pin configuration
section 9 i/o ports rev. 3.00 sep 27, 2006 page 273 of 872 rej09b0325-0300 9.5.2 register descriptions table 9.6 summarizes the registers of port 4. table 9.6 port 4 registers address * name abbreviation r/w initial value h'ffc5 port 4 data direction register p4ddr w h'00 h'ffc7 port 4 data register p4dr r/w h'00 h'ffda port 4 input pull-up mos control register p4pcr r/w h'00 note: * lower 16 bits of the address. port 4 data direction register (p4ddr) p4ddr is an 8-bit write-only register that can select input or output for each pin in port 4. bit initial value read/write 7 p4 ddr 0 w port 4 data direction 7 to 0 these bits select input or output for port 4 pins 7 6 p4 ddr 0 w 6 5 p4 ddr 0 w 5 4 p4 ddr 0 w 4 3 p4 ddr 0 w 3 2 p4 ddr 0 w 2 1 p4 ddr 0 w 1 0 p4 ddr 0 w 0 modes 1 to 6 (expanded modes): when all areas are designated as 8-bit-access areas using the bus width control register (abwcr) of the bus controller, selecting 8-bit bus mode, port 4 functions as a generic input/output port. a pin in port 4 becomes an output port if the corresponding p4ddr bit is set to 1, and an input port if this bit is cleared to 0. when at least one area is designated as a 16-bit-access area, selecting 16-bit bus mode, port 4 functions as part of the data bus regardless of the value in p4ddr. mode 7 (single-chip mode): port 4 functions as an input/output port. a pin in port 4 becomes an output port if the corresponding p4ddr bit is set to 1, and an input port if this bit is cleared to 0. p4ddr is a write-only register. its value cannot be read. all bits return 1 when read. p4ddr is initialized to h'00 by a reset and in hardware standby mode. in software standby mode it retains its previous setting.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 274 of 872 rej09b0325-0300 abwcr and p4ddr are not initialized in software standby mode. when port 4 functions as a generic input/output port, if a p4ddr bit is set to 1, the corresponding pin maintains its output state in software standby mode. port 4 data register (p4dr) p4dr is an 8-bit readable/writable register that stores output data for pins p4 7 to p4 0 . while port 4 acts as an output port, the value of this register is output. when a bit in p4ddr is set to 1, if port 4 is read the value of the corresponding p4dr bit is returned. when a bit in p4ddr is cleared to 0, if port 4 is read the corresponding pin level is read. bit initial value read/write 7 p4 0 r/w port 4 data 7 to 0 these bits store data for port 4 pins 7 6 p4 0 r/w 6 5 p4 0 r/w 5 4 p4 0 r/w 4 3 p4 0 r/w 3 2 p4 0 r/w 2 1 p4 0 r/w 1 0 p4 0 r/w 0 p4dr is initialized to h'00 by a reset and in hardware standby mode. in software standby mode it retains its previous setting. port 4 input pull-up mos control register (p4pcr) p4pcr is an 8-bit readable/writable register that controls the mos input pull-up transistors in port 4. bit initial value read/write 7 p4 pcr 0 r/w port 4 input pull-up mos control 7 to 0 these bits control input pull-up mos transistors built into port 4 7 6 p4 pcr 0 r/w 6 5 p4 pcr 0 r/w 5 4 p4 pcr 0 r/w 4 3 p4 pcr 0 r/w 3 2 p4 pcr 0 r/w 2 1 p4 pcr 0 r/w 1 0 p4 pcr 0 r/w 0 in mode 7 (single-chip mode), and in 8-bit bus mode in modes 1 to 6 (expanded modes), when a p4ddr bit is cleared to 0 (selecting generic input), if the corresponding p4pcr bit is set to 1, the input pull-up mos transistor is turned on.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 275 of 872 rej09b0325-0300 p4pcr is initialized to h'00 by a reset and in hardware standby mode. in software standby mode it retains its previous setting. table 9.7 summarizes the states of the input pull-ups mos in the 8-bit and 16-bit bus modes. table 9.7 input pull-up mos transistor states (port 4) mode reset hardware standby mode software standby mode other modes 8-bit bus mode on/off on/off 1 to 6 16-bit bus mode off off 7 off off on/off on/off legend: off: the input pull-up mos transistor is always off. on/off: the input pull-up mos transistor is on if p4pcr = 1 and p4ddr = 0. otherwise, it is off.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 276 of 872 rej09b0325-0300 9.6 port 5 9.6.1 overview port 5 is a 4-bit input/output port with the pin configuration shown in figure 9.5. the pin functions differ depending on the operating mode. in modes 1 to 4 (expanded modes with on-chip rom disabled), port 5 consists of address output pins (a 19 to a 16 ). in modes 5 and 6 (expanded modes with on-chip rom enabled), settings in the port 5 data direction register (p5ddr) designate pins for address bus output (a 19 to a 16 ) or generic input. in mode 7 (single-chip mode), port 5 is a generic input/output port. port 5 has software-programmable built-in pull-up mos transistors. pins in port 5 can drive one ttl load and a 90-pf capacitive load. they can also drive an led or a darlington transistor pair. port 5 p5 /a p5 /a p5 /a p5 /a 3 2 1 0 19 18 17 16 a (output) a (output) a (output) a (output) 19 18 17 16 p5 (input)/a (output) p5 (input)/a (output) p5 (input)/a (output) p5 (input)/a (output) 3 2 1 0 port 5 pins modes 1 to 4 modes 5 and 6 p5 (input/output) p5 (input/output) p5 (input/output) p5 (input/output) 3 2 1 0 mode 7 19 18 17 16 figure 9.5 port 5 pin configuration
section 9 i/o ports rev. 3.00 sep 27, 2006 page 277 of 872 rej09b0325-0300 9.6.2 register descriptions table 9.8 summarizes the registers of port 5. table 9.8 port 5 registers initial value address * name abbreviation r/w modes 1 to 4 modes 5 to 7 h'ffc8 port 5 data direction register p5ddr w h'ff h'f0 h'ffca port 5 data register p5dr r/w h'f0 h'f0 h'ffdb port 5 input pull-up mos control register p5pcr r/w h'f0 h'f0 note: * lower 16 bits of the address. port 5 data direction register (p5ddr) p5ddr is an 8-bit write-only register that can select input or output for each pin in port 5. bits 7 to 4 are reserved. they cannot be modified and are always read as 1. bit modes 1 to 4 initial value read/write initial value read/write modes 5 to 7 7 ? 1 ? 1 ? 6 ? 1 ? 1 ? 5 ? 1 ? 1 ? 4 ? 1 ? 1 ? 3 p5 ddr 1 ? 0 w 3 2 p5 ddr 1 ? 0 w 2 1 p5 ddr 1 ? 0 w 1 0 p5 ddr 1 ? 0 w 0 reserved bits port 5 data direction 3 to 0 these bits select input or output for port 5 pins modes 1 to 4 (expanded modes with on-chip rom disabled): p5ddr values are fixed at 1 and cannot be modified. port 5 functions as an address bus. modes 5 and 6 (expanded modes with on-chip rom enabled): following a reset, port 5 is an input port. a pin in port 5 becomes an address output pin if the corresponding p5ddr bit is set to 1, and an input port if this bit is cleared to 0.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 278 of 872 rej09b0325-0300 mode 7 (single-chip mode): port 5 functions as an input/output port. a pin in port 5 becomes an output port if the corresponding p5ddr bit is set to 1, and an input port if this bit is cleared to 0. in modes 1 to 4, p5ddr always returns 1 when read. no value can be written to. in modes 5 to 7, p5ddr is a write-only register. its value cannot be read. all bits return 1 when read. p5ddr is initialized to h'ff in modes 1 to 4 and h'f0 in modes 5 to 7 by a reset and in hardware standby mode. in software standby mode it retains its previous setting, so if a p5ddr bit is set to 1 while port 5 acts as an i/o port, the corresponding pin maintains its output state in software standby mode. port 5 data register (p5dr) p5dr is an 8-bit readable/writable register that stores output data for pins p5 3 to p5 0 . while port 5 acts as an output port, the value of this register is output. when a bit in p5ddr is set to 1, if port 5 is read the value of the corresponding p5dr bit is returned. when a bit in p5ddr is cleared to 0, if port 5 is read the corresponding pin level is read. bits 7 to 4 are reserved. they cannot be modified and are always read as 1. bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 p5 0 r/w 3 2 p5 0 r/w 2 1 p5 0 r/w 1 0 p5 0 r/w 0 reserved bits these bits store data for port 5 pins port 5 data 3 to 0 p5dr is initialized to h'f0 by a reset and in hardware standby mode. in software standby mode it retains its previous setting.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 279 of 872 rej09b0325-0300 port 5 input pull-up mos control register (p5pcr) p5pcr is an 8-bit readable/writable register that controls the mos input pull-up mos transistors in port 5. bits 7 to 4 are reserved. they cannot be modified and are always read as 1. bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 p5 pcr 0 r/w 3 2 p5 pcr 0 r/w 2 1 p5 pcr 0 r/w 1 0 p5 pcr 0 r/w 0 reserved bits these bits control input pull-up mos transistors built into port 5 port 5 input pull-up mos control 3 to 0 in modes 5 to 7, when a p5ddr bit is cleared to 0 (selecting generic input), if the corresponding bit from p5 3 pcr to p5 0 pcr is set to 1, the input pull-up mos transistor is turned on. p5pcr is initialized to h'f0 by a reset and in hardware standby mode. in software standby mode it retains its previous setting. table 9.9 summarizes the states of the input pull-ups mos in each mode. table 9.9 input pull-up mos transistor states (port 5) mode reset hardware standby mode software standby mode other modes 1 off off off off 2 3 4 5 off off on/off on/off 6 7 legend: off: the input pull-up mos transistor is always off. on/off: the input pull-up mos transistor is on if p5pcr = 1 and p5ddr = 0. otherwise, it is off.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 280 of 872 rej09b0325-0300 9.7 port 6 9.7.1 overview port 6 is a 7-bit input/output port that is also used for input and output of bus control signals ( lwr , hwr , rd , as , back , breq , and wait ). when dram is connected to area 3, lwr , hwr , and rd also function as lw , uw , and cas , or lcas , ucas , and we , respectively. for details see section 7, refresh controller. figure 9.6 shows the pin configuration of port 6. in modes 1 to 6 (expanded modes) the pin functions are lwr , hwr , rd , as , p6 2 / back , p6 1 / breq , and p6 0 / wait . see table 9.11 for the method of selecting the pin states. in mode 7 (single-chip mode) port 6 is a generic input/output port. pins in port 6 can drive one ttl load and a 30-pf capacitive load. they can also drive a darlington transistor pair. port 6 p6 / p6 / p6 / p6 / p6 / p6 / p6 / 6 5 4 3 2 1 0 lwr hwr rd as back breq wait port 6 pins p6 p6 p6 2 1 0 lwr hwr rd as back breq wait modes 1 to 6 (expanded modes) (output) (output) (output) (output) (output) (input) (input) p6 p6 p6 p6 p6 p6 p6 6 5 4 3 2 1 0 mode 7 (single-chip mode) (input/output) (input/output) (input/output) (input/output) (input/output) (input/output) (input/output) (input/output)/ (input/output)/ (input/output)/ figure 9.6 port 6 pin configuration
section 9 i/o ports rev. 3.00 sep 27, 2006 page 281 of 872 rej09b0325-0300 9.7.2 register descriptions table 9.10 summarizes the registers of port 6. table 9.10 port 6 registers initial value address * name abbreviation r/w modes 1 to 5 modes 6, 7 h'ffc9 port 6 data direction register p6ddr w h'f8 h'80 h'ffcb port 6 data register p6dr r/w h'80 h'80 note: * lower 16 bits of the address. port 6 data direction register (p6ddr) p6ddr is an 8-bit write-only register that can select input or output for each pin in port 6. bit 7 is reserved. it cannot be modified and is always read as 1. bit initial value read/write 7 ? 1 ? 6 p6 ddr 0 w 6 5 p6 ddr 0 w 5 4 p6 ddr 0 w 4 3 p6 ddr 0 w 3 2 p6 ddr 0 w 2 1 p6 ddr 0 w 1 0 p6 ddr 0 w 0 port 6 data direction 6 to 0 these bits select input or output for port 6 pins reserved bit modes 1 to 6 (expanded modes): ports p6 6 to p6 3 function as bus control output pins ( lwr , hwr , rd , as ), regardless of the settings of p6 6 ddr to p6 3 ddr. ports p6 2 to p6 0 function as the bus control pins ( back , breq , wait ) or i/o ports. for selecting the pin function, see table 9.11. when ports p6 2 to p6 0 function as i/o ports and if p6ddr is set to 1, the corresponding pin of port 6 functions as an output port. if p6ddr is cleared to 0, the corresponding pin functions as an input port. mode 7 (single-chip mode): port 6 is a generic input/output port. a pin in port 6 becomes an output port if the corresponding p6ddr bit is set to 1, and an input port if this bit is cleared to 0. p6ddr is a write-only register. its value cannot be read. all bits return 1 when read. p6ddr is initialized to h'80 by a reset and in hardware standby mode. in software standby mode it retains its previous setting. if a p6ddr bit is set to 1 while port 6 acts as an i/o port, the corresponding pin maintains its output state in software standby mode.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 282 of 872 rej09b0325-0300 port 6 data register (p6dr) p6dr is an 8-bit readable/writable register that stores output data for pins p6 6 to p6 0 . when this register is read, bits 6 to 0 each returns the logic level of the pin, when the corresponding bit of p6ddr is 0. when the corresponding bit of p6ddr is 1, bits 6 to 0 return the p6dr value. bit initial value read/write 7 ? 1 ? 6 p6 0 r/w 6 5 p6 0 r/w 5 4 p6 0 r/w 4 3 p6 0 r/w 3 2 p6 0 r/w 2 1 p6 0 r/w 1 0 p6 0 r/w 0 reserved bit port 6 data 6 to 0 these bits store data for port 6 pins bit 7 is reserved, cannot be modified, and always read as 1. p6dr is initialized to h'80 by a reset and in hardware standby mode. in software standby mode it retains its previous setting. table 9.11 port 6 pin functions in modes 1 to 6 pin pin functions and selection method p6 6 / lwr functions as follows regardless of p6 6 ddr p6 6 ddr 0 1 pin function lwr output p6 5 / hwr functions as follows regardless of p6 5 ddr p6 5 ddr 0 1 pin function hwr output p6 4 / rd functions as follows regardless of p6 4 ddr p6 4 ddr 0 1 pin function rd output
section 9 i/o ports rev. 3.00 sep 27, 2006 page 283 of 872 rej09b0325-0300 pin pin functions and selection method p6 3 / as functions as follows regardless of p6 3 ddr p6 3 ddr 0 1 pin function as output p6 2 / back bit brle in brcr and bit p6 2 ddr select the pin function as follows brle 0 1 p6 2 ddr 0 1 ? pin function p6 2 input p6 2 output back output p6 1 / breq bit brle in brcr and bit p6 1 ddr select the pin function as follows brle 0 1 p6 1 ddr 0 1 ? pin function p6 1 input p6 1 output breq input p6 0 / wait bits wce7 to wce0 in wcer, bit wms1 in wcr, and bit p6 0 ddr select the pin function as follows wcer all 1s not all 1s wms1 0 1 ? p6 0 ddr 0 1 0 * 0 * pin function p6 0 input p6 0 output wait input note: * do not set bit p6 0 ddr to 1.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 284 of 872 rej09b0325-0300 9.8 port 7 9.8.1 overview port 7 is an 8-bit input port that is also used for analog input to the a/d converter and analog output from the d/a converter. the pin functions are the same in all operating modes. figure 9.7 shows the pin configuration of port 7. for the analog input pins of the a/d converter, see section 15, a/d converter. for the analog input pins of the d/a converter, see section 16, d/a converter. port 7 p7 (input)/an (input)/da (output) p7 (input)/an (input)/da (output) p7 (input)/an (input) p7 (input)/an (input) p7 (input)/an (input) p7 (input)/an (input) p7 (input)/an (input) p7 (input)/an (input) 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 port 7 pins 1 0 figure 9.7 port 7 pin configuration
section 9 i/o ports rev. 3.00 sep 27, 2006 page 285 of 872 rej09b0325-0300 9.8.2 register description table 9.12 summarizes the port 7 register. port 7 is an input-only port, so it has no data direction register. table 9.12 port 7 data register address * name abbreviation r/w initial value h'ffce port 7 data register p7dr r undetermined note: * lower 16 bits of the address. port 7 data register (p7dr) bit initial value read/write 0 p7 ? r * note: * determined by pins p7 7 to p7 0 . 0 1 p7 ? r * 1 2 p7 ? r * 2 3 p7 ? r * 3 4 p7 ? r * 4 5 p7 ? r * 5 6 p7 ? r * 6 7 p7 ? r * 7 when p7dr is read, the logic level of the pin is always read. no data can be written to.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 286 of 872 rej09b0325-0300 9.9 port 8 9.9.1 overview port 8 is a 5-bit input/output port that is also used for cs 3 to cs 0 output, rfsh output, and irq 3 to irq 0 input. figure 9.8 shows the pin configuration of port 8. in modes 1 to 6 (expanded modes), port 8 can provide cs 3 to cs 0 output, rfsh output, and irq 3 to irq 0 input. see table 9.14 for the selection of pin functions in expanded modes. in mode 7 (single-chip mode), port 8 can provide irq 3 to irq 0 input. see table 9.15 for the selection of pin functions in single-chip mode. the irq 3 to irq 0 functions are selected by ier settings, regardless of whether the pin is used for input or output. for details see section 5, interrupt controller. pins in port 8 can drive one ttl load and a 90-pf capacitive load. they can also drive a darlington transistor pair. pins p8 2 to p8 0 have schmitt-trigger inputs.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 287 of 872 rej09b0325-0300 port 8 p8 / p8 / / p8 / / p8 / / p8 / / 4 3 2 1 0 0 1 2 3 port 8 pins cs cs cs cs rfsh 3 2 1 irq irq irq irq 0 p8 (input)/ (output) p8 (input)/ (output)/ (input) p8 (input)/ (output)/ (input) p8 (input)/ (output)/ (input) p8 (input/output)/ (output)/ (input) 4 3 2 1 0 pin functions in modes 1 to 6 (expanded modes) 0 1 2 3 cs cs cs cs rfsh 3 2 1 irq irq irq irq 0 p8 /(input/output) p8 /(input/output)/ (input) p8 /(input/output)/ (input) p8 /(input/output)/ (input) p8 /(input/output)/ (input) 4 3 2 1 0 pin functions in mode 7 (single-chip mode) irq irq irq irq 3 2 1 0 figure 9.8 port 8 pin configuration 9.9.2 register descriptions table 9.13 summarizes the registers of port 8. table 9.13 port 8 registers initial value address * name abbreviation r/w modes 1 to 4 modes 5 to 7 h'ffcd port 8 data direction register p8ddr w h'f0 h'e0 h'ffcf port 8 data register p8dr r/w h'e0 h'e0 note: * lower 16 bits of the address.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 288 of 872 rej09b0325-0300 port 8 data direction register (p8ddr) p8ddr is an 8-bit write-only register that can select input or output for each pin in port 8. bits 7 to 5 are reserved. they cannot be modified and are always read as 1. 7 ? 1 ? 1 ? 6 ? 1 ? 1 ? 5 ? 1 ? 1 ? 4 p8 ddr 1 w 0 w 4 3 p8 ddr 0 w 0 w 3 2 p8 ddr 0 w 0 w 2 1 p8 ddr 0 w 0 w 1 0 p8 ddr 0 w 0 w 0 reserved bits port 8 data direction 4 to 0 these bits select input or output for port 8 pins bit modes 1 to 4 initial value read/write initial value read/write modes 5 to 7 modes 1 to 6 (expanded modes): when bits in p8ddr bit are set to 1, p8 4 to p8 1 become cs 0 to cs 3 output pins. when bits in p8ddr are cleared to 0, the corresponding pins become input ports. in modes 1 to 4 (expanded modes with on-chip rom disabled), following a reset only cs 0 is output. the other three pins are input ports. in modes 5 and 6 (expanded modes with on-chip rom enabled), following a reset all four pins are input ports. when the refresh controller is enabled, p8 0 is used unconditionally for rfsh output. when the refresh controller is disabled, p8 0 becomes a generic input/output port according to the p8ddr setting. for details see table 9.15. mode 7 (single-chip mode): port 8 is a generic input/output port. a pin in port 8 becomes an output port if the corresponding p8ddr bit is set to 1, and an input port if this bit is cleared to 0. p8ddr is a write-only register. its value cannot be read. all bits return 1 when read. p8ddr is initialized to h'f0 in modes 1 to 4 and h'e0 in modes 5 to 7 by a reset and in hardware standby mode. in software standby mode it retains its previous setting, so if a p8ddr bit is set to 1 while port 8 acts as an i/o port, the corresponding pin maintains its output state in software standby mode.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 289 of 872 rej09b0325-0300 port 8 data register (p8dr) p8dr is an 8-bit readable/writable register that stores output data for pins p8 4 to p8 0 . while port 8 acts as an output port, the value of this register is output. when a bit in p8ddr is set to 1, if port 8 is read the value of the corresponding p8dr bit is returned. when a bit in p8ddr is cleared to 0, if port 8 is read the corresponding pin level is read. bits 7 to 5 are reserved. they cannot be modified and always are read as 1. bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 p8 0 r/w 4 3 p8 0 r/w 3 2 p8 0 r/w 2 1 p8 0 r/w 1 0 p8 0 r/w 0 reserved bits port 8 data 4 to 0 these bits store data for port 8 pins p8dr is initialized to h'e0 by a reset and in hardware standby mode. in software standby mode it retains its previous setting.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 290 of 872 rej09b0325-0300 table 9.14 port 8 pin functions in modes 1 to 6 pin pin functions and selection method p8 4 / cs 0 bit p8 4 ddr selects the pin function as follows p8 4 ddr 0 1 pin function p8 4 input cs 0 output p8 3 / cs 1 / irq 3 bit p8 3 ddr selects the pin function as follows p8 3 ddr 0 1 p8 3 input cs 1 output pin function irq 3 input p8 2 / cs 2 / irq 2 bit p8 2 ddr selects the pin function as follows p8 2 ddr 0 1 p8 2 input cs 2 output pin function irq 2 input p8 1 / cs 3 / irq 1 bit p8 1 ddr selects the pin function as follows p8 1 ddr 0 1 p8 1 input cs 3 output pin function irq 1 input p8 0 / rfsh / irq 0 bit rfshe in rfshcr and bit p8 0 ddr select the pin function as follows rfshe 0 1 p8 0 ddr 0 1 ? p8 0 input p8 0 output rfsh output pin function irq 0 input
section 9 i/o ports rev. 3.00 sep 27, 2006 page 291 of 872 rej09b0325-0300 table 9.15 port 8 pin functions in mode 7 pin pin functions and selection method p8 4 bit p8 4 ddr selects the pin function as follows p8 4 ddr 0 1 pin function p8 4 input p8 4 output p8 3 / irq 3 bit p8 3 ddr selects the pin function as follows p8 3 ddr 0 1 p8 3 input p8 3 output pin function irq 3 input p8 2 / irq 2 bit p8 2 ddr selects the pin function as follows p8 2 ddr 0 1 p8 2 input p8 2 output pin function irq 2 input p8 1 / irq 1 bit p8 1 ddr selects the pin function as follows p8 1 ddr 0 1 p8 1 input p8 1 output pin function irq 1 input p8 0 / irq 0 bit p8 0 ddr select the pin function as follows p8 0 ddr 0 1 p8 0 input p8 0 output pin function irq 0 input
section 9 i/o ports rev. 3.00 sep 27, 2006 page 292 of 872 rej09b0325-0300 9.10 port 9 9.10.1 overview port 9 is a 6-bit input/output port that is also used for input and output (txd 0 , txd 1 , rxd 0 , rxd 1 , sck 0 , sck 1 ) by serial communication interface channels 0 and 1 (sci0 and sci1), and for irq 5 and irq 4 input. see table 9.17 for the selection of pin functions. the irq 5 and irq 4 functions are selected by ier settings, regardless of whether the pin is used for input or output. for details see section 5, interrupt controller. port 9 has the same set of pin functions in all operating modes. figure 9.9 shows the pin configuration of port 9. pins in port 9 can drive one ttl load and a 30-pf capacitive load. they can also drive a darlington transistor pair. port 9 p9 (input/output)/sck p9 (input/output)/sck p9 (input/output)/rxd (input) p9 (input/output)/rxd (input) p9 (input/output)/txd (output) p9 (input/output)/txd (output) 5 4 3 2 1 0 port 9 pins 1 0 (input/output)/ irq (input) (input/output)/ irq (input) 5 4 1 0 1 0 figure 9.9 port 9 pin configuration
section 9 i/o ports rev. 3.00 sep 27, 2006 page 293 of 872 rej09b0325-0300 9.10.2 register descriptions table 9.16 summarizes the registers of port 9. table 9.16 port 9 registers address * name abbreviation r/w initial value h'ffd0 port 9 data direction register p9ddr w h'c0 h'ffd2 port 9 data register p9dr r/w h'c0 note: * lower 16 bits of the address. port 9 data direction register (p9ddr) p9ddr is an 8-bit write-only register that can select input or output for each pin in port 9. bits 7 and 6 are reserved. they cannot be modified and are always read as 1. bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 p9 ddr 0 w 5 4 p9 ddr 0 w 4 3 p9 ddr 0 w 3 2 p9 ddr 0 w 2 1 p9 ddr 0 w 1 0 p9 ddr 0 w 0 reserved bits port 9 data direction 5 to 0 these bits select input or output for port 9 pins while port 9 acts as an i/o port, a pin in port 9 becomes an output port if the corresponding p9ddr bit is set to 1, and an input port if this bit is cleared to 0. for selecting the pin function, see table 9.17. p9ddr is a write-only register. its value cannot be read. all bits return 1 when read. p9ddr is initialized to h'c0 by a reset and in hardware standby mode. in software standby mode it retains its previous setting. if a p9ddr bit is set to 1 while port 9 acts as an i/o port, the corresponding pin maintains its output state in software standby mode.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 294 of 872 rej09b0325-0300 port 9 data register (p9dr) p9dr is an 8-bit readable/writable register that stores output data for pins p9 5 to p9 0 . while port 9 acts as an output port, the value of this register is output. when a bit in p9ddr is set to 1, if port 9 is read the value of the corresponding p9dr bit is returned. when a bit in p9ddr is cleared to 0, if port 9 is read the corresponding pin level is read. bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 p9 0 r/w 4 p9 0 r/w 4 3 p9 0 r/w 3 2 p9 0 r/w 2 1 p9 0 r/w 1 0 p9 0 r/w 0 reserved bits port 9 data 5 to 0 these bits store data for port 9 pins 5 bits 7 and 6 are reserved. they cannot be modified and are always read as 1. p9dr is initialized to h'c0 by a reset and in hardware standby mode. in software standby mode it retains its previous setting.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 295 of 872 rej09b0325-0300 table 9.17 port 9 pin functions pin pin functions and selection method p9 5 /sck 1 / irq 5 bit c/ a in smr of sci1, bits cke0 and cke1 in scr of sci1, and bit p9 5 ddr select the pin function as follows cke1 0 1 c/ a 01 ? cke0 0 1 ?? p9 5 ddr 0 1 ??? p9 5 input p9 5 output sck 1 output sck 1 output sck 1 input pin function irq 5 input p9 4 /sck 0 / irq 4 bit c/ a in smr of sci0, bits cke0 and cke1 in scr of sci0, and bit p9 4 ddr select the pin function as follows cke1 0 1 c/ a 01 ? cke0 0 1 ?? p9 4 ddr 0 1 ??? p9 4 input p9 4 output sck 0 output sck 0 output sck 0 input pin function irq 4 input p9 3 /rxd 1 bit re in scr of sci1 and bit p9 3 ddr select the pin function as follows re 0 1 p9 3 ddr 0 1 ? pin function p9 3 input p9 3 output rxd 1 input p9 2 /rxd 0 bit re in scr of sci0, bit smif in scmr, and bit p9 2 ddr select the pin function as follows smif 0 1 re 0 1 ? p9 2 ddr 0 1 ?? pin function p9 2 input p9 2 output rxd 0 input rxd 0 input
section 9 i/o ports rev. 3.00 sep 27, 2006 page 296 of 872 rej09b0325-0300 pin pin functions and selection method p9 1 /txd 1 bit te in scr of sci1 and bit p9 1 ddr select the pin function as follows te 0 1 p9 1 ddr 0 1 ? pin function p9 1 input p9 1 output txd 1 output p9 0 /txd 0 bit te in scr of sci0, bit smif in scmr, and bit p9 0 ddr select the pin function as follows smif 0 1 te 0 1 ? p9 0 ddr 0 1 ?? pin function p9 0 input p9 0 output txd 0 output txd 0 output * note: * functions as the txd 0 output pin, but there are two states: one in which the pin is driven, and another in which the pin is at high- impedance.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 297 of 872 rej09b0325-0300 9.11 port a 9.11.1 overview port a is an 8-bit input/output port that is also used for output (tp 7 to tp 0 ) from the programmable timing pattern controller (tpc), input and output (tiocb 2 , tioca 2 , tiocb 1 , tioca 1 , tiocb 0 , tioca 0 , tclkd, tclkc, tclkb, tclka) by the 16-bit integrated timer unit (itu), output ( tend 1 , tend 0 ) from the dma controller (dmac), cs 4 to cs 6 output, and address output (a 23 to a 20 ). a reset or hardware standby leaves port a as an input port, except that in modes 3, 4, and 6, one pin is always used for a 20 output. for selecting the pin function, see table 9.19. usage of pins for tpc, itu, and dmac input and output is described in the sections on those modules. for output of address bits a 23 to a 21 in modes 3, 4, and 6, see section 6.2.5, bus release control register (brcr). for output of cs 4 to cs 6 in modes 1 to 6, see section 6.3.2, chip select signals. pins not assigned to any of these functions are available for generic input/output. figure 9.10 shows the pin configuration of port a. pins in port a can drive one ttl load and a 30-pf capacitive load. they can also drive a darlington transistor pair. port a has schmitt-trigger inputs.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 298 of 872 rej09b0325-0300 port a pa /tp /tiocb /a pa /tp /tioca /a 21 / cs 4 pa /tp /tiocb /a 22 / cs 5 pa /tp /tioca /a 23 / cs 6 pa /tp /tiocb /tclkd pa /tp /tioca /tclkc pa /tp / tend /tclkb pa /tp / tend /tclka 7 6 5 4 3 2 1 0 port a pins 7 6 5 4 3 2 1 0 2 2 1 1 1 0 0 0 pa (input/output)/tp (output)/tiocb (input/output) pa (input/output)/tp (output)/tioca (input/output)/ cs 4 (output) pa (input/output)/tp (output)/tiocb (input/output)/ cs 5 (output) pa (input/output)/tp (output)/tioca (input/output)/ cs 6 (output) 7 6 5 4 3 2 1 0 pin functions in modes 1, 2, and 5 pa (input/output)/tp (output)/tiocb (input/output)/tclkd (input) pa (input/output)/tp (output)/tioca (input/output)/tclkc (input) pa (input/output)/tp (output)/ tend (output)/tclkb (input) pa (input/output)/tp (output)/ tend (output)/tclka (input) pin functions in mode 7 7 6 5 4 3 2 1 0 2 2 1 1 0 0 1 0 a 20 (output) pa (input/output)/tp (output)/tioca (input/output)/a (output)/ cs 4 (output) pa (input/output)/tp (output)/tiocb (input/output)/a (output)/ cs 5 (output) pa (input/output)/tp (output)/tioca (input/output)/a (output)/ cs 6 (output) 6 5 4 3 2 1 0 pin functions in modes 3, 4, and 6 6 5 4 3 2 1 0 2 1 1 0 0 pa (input/output)/tp (output)/ tend (output)/tclka (input) pa (input/output)/tp (output)/tiocb (input/output)/tclkd (input) pa (input/output)/tp (output)/tioca (input/output)/tclkc (input) pa (input/output)/tp (output)/ tend (output)/tclkb (input) pa 7 (input/output)/tp 7 (output)/tiocb 2 (input/output) pa 6 (input/output)/tp 6 (output)/tioca 2 (input/output) pa 5 (input/output)/tp 5 (output)/tiocb 1 (input/output) pa 4 (input/output)/tp 4 (output)/tioca 1 (input/output) pa 3 (input/output)/tp 3 (output)/tiocb 0 (input/output)/tclkd (input) pa 2 (input/output)/tp 2 (output)/tioca 0 (input/output)/tclkc (input) pa 1 (input/output)/tp 1 (output)/ tend 1 (output)/tclkb (input) pa 0 (input/output)/tp 0 (output)/ tend 0 (output)/tclka (input) 1 0 20 21 22 23 figure 9.10 port a pin configuration
section 9 i/o ports rev. 3.00 sep 27, 2006 page 299 of 872 rej09b0325-0300 9.11.2 register descriptions table 9.18 summarizes the registers of port a. table 9.18 port a registers initial value address * name abbreviation r/w modes 1, 2, 5, and 7 modes 3, 4, and 6 h'ffd1 port a data direction register paddr w h'00 h'80 h'ffd3 port a data register padr r/w h'00 h'00 note: * lower 16 bits of the address. port a data direction register (paddr) paddr is an 8-bit write-only register that can select input or output for each pin in port a. when pins are used for tpc output, the corresponding paddr bits must also be set. 7 pa ddr 1 ? 0 w port a data direction 7 to 0 these bits select input or output for port a pins 7 6 pa ddr 0 w 0 w 6 5 pa ddr 0 w 0 w 5 4 pa ddr 0 w 0 w 4 3 pa ddr 0 w 0 w 3 2 pa ddr 0 w 0 w 2 1 pa ddr 0 w 0 w 1 0 pa ddr 0 w 0 w 0 bit modes 3, 4, and 6 initial value read/write initial value read/write modes 1, 2, 5, and 7 while port a acts as an i/o port, a pin in port a becomes an output pin if the corresponding paddr bit is set to 1, and an input pin if this bit is cleared to 0. in modes 3, 4, and 6, pa 7 ddr is fixed at 1 and pa 7 functions as an address output pin. paddr is a write-only register. its value cannot be read. all bits return 1 when read. paddr is initialized to h'00 by a reset and in hardware standby mode in modes 1, 2, 5, and 7. it is initialized to h'80 by a reset and in hardware standby mode in modes 3, 4, and 6. in software standby mode it retains its previous setting. if a paddr bit is set to 1, the corresponding pin maintains its output state in software standby mode.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 300 of 872 rej09b0325-0300 port a data register (padr) padr is an 8-bit readable/writable register that stores output data for pins pa 7 to pa 0 . while port a acts as an output port, the value of this register is output. when a bit in paddr is set to 1, if port a is read the value of the corresponding padr bit is returned. when a bit in paddr is cleared to 0, if port a is read the corresponding pin level is read. bit initial value read/write 0 pa 0 r/w 0 1 pa 0 r/w 1 2 pa 0 r/w 2 3 pa 0 r/w 3 4 pa 0 r/w 4 5 pa 0 r/w 5 6 pa 0 r/w 6 7 pa 0 r/w 7 port a data 7 to 0 these bits store data for port a pins padr is initialized to h'00 by a reset and in hardware standby mode. in software standby mode it retains its previous setting.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 301 of 872 rej09b0325-0300 9.11.3 pin functions table 9.19 describes the selection of pin functions. table 9.19 port a pin functions pin pin functions and selection method pa 7 /tp 7 / tiocb 2 /a 20 the mode setting, itu channel 2 settings (bit pwm2 in tmdr and bits iob2 to iob0 in tior2), bit nder7 in ndera, and bit pa 7 ddr in paddr select the pin function as follows mode 1, 2, 5, 7 3, 4, 6 itu channel 2 settings (1) in table below (2) in table below ? pa 7 ddr ? 011 ? nder7 ?? 01 ? pa 7 input pa 7 output tp 7 output pin function tiocb 2 output tiocb 2 input * a 20 output note: * tiocb 2 input when iob2 = 1 and pwm2 = 0. itu channel 2 settings (2) (1) (2) iob2 0 1 iob1 001 ? iob0 0 1 ??
section 9 i/o ports rev. 3.00 sep 27, 2006 page 302 of 872 rej09b0325-0300 pin pin functions and selection method pa 6 /tp 6 / tioca 2 / a 21 / cs 4 the mode setting, bit a 21 e in brcr, bit cs4e in cscr, itu channel 2 settings (bit pwm2 in tmdr and bits ioa2 to ioa0 in tior2), bit nder6 in ndera, and bit pa 6 ddr in paddr select the pin function as follows mode 1, 2, 5 3, 4, 6 7 cs4e 0 1 0 1 ? a 21 e ?? 10 ?? itu channel 2 settings (1) in table below (2) in table below ? (1) in table below (2) in table below ?? (1) in table below (2) in table below pa 6 ddr ? 011 ?? 01 1 ?? ? 011 nder6 ?? 01 ??? 01 ???? 01 pa 6 input pa 6 out- put tp 6 out- put pa 6 input pa 6 out- put tp 6 out- put pa 6 input pa 6 out- put tp 6 out- put pin function tioca 2 output tioca 2 input * cs 4 out- put tioca 2 output tioca 2 input * a 21 out- put cs 4 out- put tioca 2 output tioca 2 input * note: * tioca 2 input when ioa2 = 1. itu channel 2 settings (2) (1) (2) (1) pwm2 0 1 ioa2 0 1 ? ioa1 0 0 1 ?? ioa0 0 1 ???
section 9 i/o ports rev. 3.00 sep 27, 2006 page 303 of 872 rej09b0325-0300 pin pin functions and selection method pa 5 /tp 5 / tiocb 1 / a 22 / cs 5 the mode setting, bit a 22 e in brcr, bit cs5e in cscr, itu channel 1 settings (bit pwm1 in tmdr and bits iob2 to iob0 in tior1), bit nder5 in ndera, and bit pa 5 ddr in paddr select the pin function as follows mode 1, 2, 5 3, 4, 6 7 cs5e 0 1 0 1 ? a 22 e ?? 10 ?? itu channel 1 settings (1) in table below (2) in table below ? (1) in table below (2) in table below ?? (1) in table below (2) in table below pa 5 ddr ? 011 ?? 01 1 ?? ? 011 nder5 ?? 01 ??? 01 ???? 01 pa 5 input pa 5 out- put tp 5 out- put pa 5 input pa 5 out- put tp 5 out- put pa 5 input pa 5 out- put tp 5 out- put pin function tiocb 1 output tiocb 1 input * cs 5 out- put tiocb 1 output tiocb 1 input * a 22 out- put cs 5 out- put tiocb 1 output tiocb 1 input * note: * tiocb 1 input when iob2 = 1 and pwm1 = 0. itu channel 1 settings (2) (1) (2) iob2 0 1 iob1 0 0 1 ? iob0 0 1 ??
section 9 i/o ports rev. 3.00 sep 27, 2006 page 304 of 872 rej09b0325-0300 pin pin functions and selection method pa 4 /tp 4 / tioca 1 / a 23 / cs 6 the mode setting, bit a 23 e in brcr, bit cs6e in cscr, itu channel 1 settings (bit pwm1 in tmdr and bits ioa2 to ioa0 in tior1), bit nder4 in ndera, and bit pa 4 ddr in paddr select the pin function as follows mode 1, 2, 5 3, 4, 6 7 cs6e 0 1 0 1 ? a 23 e ?? 10 ?? itu channel 2 settings (1) in table below (2) in table below ? (1) in table below (2) in table below ?? (1) in table below (2) in table below pa 4 ddr ? 011 ?? 01 1 ?? ? 011 nder 4 ?? 01 ??? 01 ???? 01 pa 4 input pa 4 out- put tp 4 out- put pa 4 input pa 4 out- put tp 4 out- put pa 4 input pa 4 out- put tp 4 out- put pin function tioca 1 output tioca 1 input * cs 6 out- put tioca 1 output tioca 1 input * a 23 out- put cs 6 out- put tioca 1 output tioca 1 input * note: * tioca1 input when ioa2 = 1. itu channel 1 settings (2) (1) (2) (1) pwm1 0 1 ioa2 0 1 ? ioa1 0 0 1 ?? ioa0 0 1 ???
section 9 i/o ports rev. 3.00 sep 27, 2006 page 305 of 872 rej09b0325-0300 pin pin functions and selection method pa 3 /tp 3 / tiocb 0 / tclkd itu channel 0 settings (bit pwm0 in tmdr and bits iob2 to iob0 in tior0), bits tpsc2 to tpsc0 in tcr4 to tcr0, bit nder3 in ndera, and bit pa 3 ddr in paddr select the pin function as follows itu channel 0 settings (1) in table below (2) in table below pa 3 ddr ? 011 nder3 ?? 01 pa 3 input pa 3 output tp 3 output tiocb 0 output tiocb 0 input * 1 pin function tclkd input * 2 notes: 1. tiocb 0 input when iob2 = 1 and pwm0 = 0. 2. tclkd input when tpsc2 = tpsc1 = tpsc0 = 1 in any of tcr4 to tcr0. itu channel 0 settings (2) (1) (2) iob2 0 1 iob1 0 0 1 ? iob0 0 1 ??
section 9 i/o ports rev. 3.00 sep 27, 2006 page 306 of 872 rej09b0325-0300 pin pin functions and selection method pa 2 /tp 2 / tioca 0 / tclkc itu channel 0 settings (bit pwm0 in tmdr and bits ioa2 to ioa0 in tior0), bits tpsc2 to tpsc0 in tcr4 to tcr0, bit nder2 in ndera, and bit pa 2 ddr in paddr select the pin function as follows itu channel 0 settings (1) in table below (2) in table below pa 2 ddr ? 011 nder2 ?? 01 pa 2 input pa 2 output tp 2 output tioca 0 output tioca 0 input * 1 pin function tclkc input * 2 notes: 1. tioca 0 input when ioa2 = 1. 2. tclkc input when tpsc2 = tpsc1 = 1 and tpsc0 = 0 in any of tcr4 to tcr0. itu channel 0 settings (2) (1) (2) (1) pwm0 0 1 ioa2 0 1 ? ioa1 001 ?? ioa0 0 1 ???
section 9 i/o ports rev. 3.00 sep 27, 2006 page 307 of 872 rej09b0325-0300 pin pin functions and selection method dmac channel 1 settings (bits dts2a to dts0a and dts2b to dts0b in dtcr1a and dtcr1b), bit nder1 in ndera, and bit pa 1 ddr in paddr select the pin function as follows pa 1 /tp 1 / tclkb/ tend 1 dmac channel 1 settings (1) in table below (2) in table below pa 1 ddr ? 011 nder1 ?? 01 tend 1 output pa 1 input pa 1 output tp 1 output pin function tclkb input * note: * tclkb input when mdf = 1 in tmdr, or when tpsc2 = 1, tpsc1 = 0, and tpsc0 = 1 in any of tcr4 to tcr0. dmac channel 1 settings (2) (1) (2) (1) (2) (1) dts2a, dts1a not both 1 both 1 dts0a ? 00111 dts2b 01101011 dts1b ? 01 ??? 01
section 9 i/o ports rev. 3.00 sep 27, 2006 page 308 of 872 rej09b0325-0300 pin pin functions and selection method dmac channel 0 settings (bits dts2a to dts0a and dts2b to dts0b in dtcr0a and dtcr0b), bit nder0 in ndera, and bit pa 0 ddr in paddr select the pin function as follows pa 0 /tp 0 / tclka/ tend 0 dmac channel 0 settings (1) in table below (2) in table below pa 0 ddr ? 011 nder0 ?? 01 tend 0 output pa 0 input pa 0 output tp 0 output pin function tclka input * note: * tclka input when mdf = 1 in tmdr, or when tpsc2 = 1 and tpsc1 = 0 in any of tcr4 to tcr0. dmac channel 0 settings (2) (1) (2) (1) (2) (1) dts2a, dts1a not both 1 both 1 dts0a ? 00111 dts2b 01101011 dts1b ? 01 ??? 01
section 9 i/o ports rev. 3.00 sep 27, 2006 page 309 of 872 rej09b0325-0300 9.12 port b 9.12.1 overview port b is an 8-bit input/output port that is also used for output (tp 15 to tp 8 ) from the programmable timing pattern controller (tpc), input/output (tiocb 4 , tiocb 3 , tioca 4 , tioca 3 ) and output (tocxb 4 , tocxa 4 ) by the 16-bit integrated timer unit (itu), input ( dreq 1 , dreq 0 ) to the dma controller (dmac), adtrg input to the a/d converter, and cs 7 output. a reset or hardware standby leaves port b as an input port. for selecting the pin function, see table 9.21. usage of pins for tpc, itu, dmac, and a/d converter input and output is described in the sections on those modules. for output of cs 7 in modes 1 to 6, see section 6.3.2, chip select signals. pins not assigned to any of these functions are available for generic input/output. figure 9.11 shows the pin configuration of port b. pins in port b can drive one ttl load and a 30-pf capacitive load. they can also drive an led or darlington transistor pair. pins pb 3 to pb 0 have schmitt-trigger inputs.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 310 of 872 rej09b0325-0300 port b pb 7 /tp 15 / dreq 1 / adtrg pb 6 /tp 14 / dreq 0 / cs 7 pb 5 /tp 13 /tocxb 4 pb 4 /tp 12 /tocxa 4 pb 3 /tp 11 /tiocb 4 pb 2 /tp 10 /tioca 4 pb 1 /tp 9 /tiocb 3 pb 0 /tp 8 /tioca 3 port b pins pb 7 (input/output)/tp 15 (output)/ dreq 1 (input)/ adtrg (input) pb 6 (input/output)/tp 14 (output)/ dreq 0 (input)/ cs 7 (output) pb 5 (input/output)/tp 13 (output)/tocxb 4 (output) pb 4 (input/output)/tp 12 (output)/tocxa 4 (output) pb 3 (input/output)/tp 11 (output)/tiocb 4 (input/output) pb 2 (input/output)/tp 10 (output)/tioca 4 (input/output) pb 1 (input/output)/tp 9 (output)/tiocb 3 (input/output) pb 0 (input/output)/tp 8 (output)/tioca 3 (input/output) pin functions in modes 1 to 6 pb 7 (input/output)/tp 15 (output)/ dreq 1 (input)/ adtrg (input) pb 6 (input/output)/tp 14 (output)/ dreq 0 (input) pb 5 (input/output)/tp 13 (output)/tocxb 4 (output) pb 4 (input/output)/tp 12 (output)/tocxa 4 (output) pb 3 (input/output)/tp 11 (output)/tiocb 4 (input/output) pb 2 (input/output)/tp 10 (output)/tioca 4 (input/output) pb 1 (input/output)/tp 9 (output)/tiocb 3 (input/output) pb 0 (input/output)/tp 8 (output)/tioca 3 (input/output) pin functions in mode 7 figure 9.11 port b pin configuration
section 9 i/o ports rev. 3.00 sep 27, 2006 page 311 of 872 rej09b0325-0300 9.12.2 register descriptions table 9.20 summarizes the registers of port b. table 9.20 port b registers address * name abbreviation r/w initial value h'ffd4 port b data direction register pbddr w h'00 h'ffd6 port b data register pbdr r/w h'00 note: * lower 16 bits of the address. port b data direction register (pbddr) pbddr is an 8-bit write-only register that can select input or output for each pin in port b. when pins are used for tpc output, the corresponding pbddr bits must also be set. bit initial value read/write 7 pb ddr 0 w port b data direction 7 to 0 these bits select input or output for port b pins 7 6 pb ddr 0 w 6 5 pb ddr 0 w 5 4 pb ddr 0 w 4 3 pb ddr 0 w 3 2 pb ddr 0 w 2 1 pb ddr 0 w 1 0 pb ddr 0 w 0 while port b acts as an i/o port, a pin in port b becomes an output pin if the corresponding pbddr bit is set to 1, and an input pin if this bit is cleared to 0. pbddr is a write-only register. its value cannot be read. all bits return 1 when read. pbddr is initialized to h'00 by a reset and in hardware standby mode. in software standby mode it retains its previous setting. if a pbddr bit is set to 1 while port b acts as an i/o port, the corresponding pin maintains its output state in software standby mode.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 312 of 872 rej09b0325-0300 port b data register (pbdr) pbdr is an 8-bit readable/writable register that stores output data for pins pb7 to pb0. while port b acts as an output port, the value of this register is output. when a bit in pbddr is set to 1, if port b is read the value of the corresponding pbdr bit is returned. when a bit in pbddr is cleared to 0, if port b is read the corresponding pin level is read. bit initial value read/write 0 pb 0 r/w 0 1 pb 0 r/w 1 2 pb 0 r/w 2 3 pb 0 r/w 3 4 pb 0 r/w 4 5 pb 0 r/w 5 6 pb 0 r/w 6 7 pb 0 r/w 7 port b data 7 to 0 these bits store data for port b pins pbdr is initialized to h'00 by a reset and in hardware standby mode. in software standby mode it retains its previous setting.
section 9 i/o ports rev. 3.00 sep 27, 2006 page 313 of 872 rej09b0325-0300 9.12.3 pin functions table 9.21 describes the selection of pin functions. table 9.21 port b pin functions pin pin functions and selection method dmac channel 1 settings (bits dts2a to dts0a and dts2b to dts0b in dtcr1a and dtcr1b), bit trge in adcr, bit nder15 in nderb, and bit pb 7 ddr in pbddr select the pin function as follows pb 7 /tp 15 / dreq 1 / adtrg pb 7 ddr 0 1 1 nder15 ? 01 pb 7 input pb 7 output tp 15 output dreq 1 input * 1 pin function adtrg input * 2 notes: 1. dreq 1 input under dmac channel 1 settings (1) in the table below. 2. adtrg input when trge = 1. dmac channel 1 settings (2) (1) (2) (1) (2) (1) dts2a, dts1a not both 1 both 1 dts0a ? 00111 dts2b 01101011 dts1b ? 01 ??? 01
section 9 i/o ports rev. 3.00 sep 27, 2006 page 314 of 872 rej09b0325-0300 pin pin functions and selection method bit cs7e in cscr, dmac channel 0 settings (bits dts2a to dts0a and dts2b to dts0b in dtcr0a and dtcr0b), bit nder14 in nderb, and bit pb 6 ddr in pbddr select the pin function as follows pb 6 /tp 14 / dreq 0 / cs 7 pb 6 ddr 0 1 1 ? cs7e 0001 nder14 ? 01 ? pb 6 input pb 6 output tp 14 output ? pin function dreq 0 input * cs 7 output note: * dreq 0 input under dmac channel 0 settings (1) in the table below. dmac channel 0 settings (2) (1) (2) (1) (2) (1) dts2a, dts1a not both 1 both 1 dts0a ? 00111 dts2b 01101011 dts1b ? 01 ??? 01 itu channel 4 settings (bit cmd1 in tfcr and bit exb4 in toer), bit nder13 in nderb, and bit pb 5 ddr in pbddr select the pin function as follows pb 5 /tp 13 / tocxb 4 exb4, cmd1 not both 1 both 1 pb 5 ddr 0 1 1 ? nder13 ? 01 ? pin function pb 5 input pb 5 output tp 13 output tocxb 4 output pb 4 /tp 12 / tocxa 4 itu channel 4 settings (bit cmd1 in tfcr and bit exa4 in toer), bit nder12 in nderb, and bit pb 4 ddr in pbddr select the pin function as follows exa4, cmd1 not both 1 both 1 pb 4 ddr 0 1 1 ? nder12 ? 01 ? pin function pb 4 input pb 4 output tp 12 output tocxa 4 output
section 9 i/o ports rev. 3.00 sep 27, 2006 page 315 of 872 rej09b0325-0300 pin pin functions and selection method itu channel 4 settings (bit pwm4 in tmdr, bit cmd1 in tfcr, bit eb4 in toer, and bits iob2 to iob0 in tior4), bit nder11 in nderb, and bit pb 3 ddr in pbddr select the pin function as follows pb 3 /tp 11 / tiocb 4 itu channel 4 settings (1) in table below (2) in table below pb 3 ddr ? 011 nder11 ?? 01 pb 3 input pb 3 output tp 11 output pin function tiocb 4 output tiocb 4 input * note: * tiocb 4 input when cmd1 = pwm4 = 0 and iob2 = 1. itu channel 4 settings (2) (2) (1) (2) (1) eb4 0 1 cmd1 ? 01 iob2 ? 0001 ? iob1 ? 001 ?? iob0 ? 01 ???
section 9 i/o ports rev. 3.00 sep 27, 2006 page 316 of 872 rej09b0325-0300 pin pin functions and selection method itu channel 4 settings (bit cmd1 in tfcr, bit ea4 in toer, bit pwm4 in tmdr, and bits ioa2 to ioa0 in tior4), bit nder10 in nderb, and bit pb 2 ddr in pbddr select the pin function as follows pb 2 /tp 10 / tioca 4 itu channel 4 settings (1) in table below (2) in table below pb 2 ddr ? 011 nder10 ?? 01 pb 2 input pb 2 output tp 10 output pin function tioca 4 output tioca 4 input * note: * tioca 4 input when cmd1 = pwm4 = 0 and ioa2 = 1. itu channel 4 settings (2) (2) (1) (2) (1) ea4 0 1 cmd1 ? 01 pwm4 ? 01 ? ioa2 ? 0001 ?? ioa1 ? 001 ??? ioa0 ? 01 ????
section 9 i/o ports rev. 3.00 sep 27, 2006 page 317 of 872 rej09b0325-0300 pin pin functions and selection method itu channel 3 settings (bit pwm3 in tmdr, bit cmd1 in tfcr, bit eb3 in toer, and bits iob2 to iob0 in tior3), bit nder9 in nderb, and bit pb 1 ddr in pbddr select the pin function as follows pb 1 /tp 9 / tiocb 3 itu channel 3 settings (1) in table below (2) in table below pb 1 ddr ? 011 nder9 ?? 01 pb 1 input pb 1 output tp 9 output pin function tiocb 3 output tiocb 3 input * note: * tiocb 3 input when cmd1 = pwm3 = 0 and iob2 = 1. itu channel 3 settings (2) (2) (1) (2) (1) eb3 0 1 cmd1 ? 01 iob2 ? 0001 ? iob1 ? 001 ?? iob0 ? 01 ???
section 9 i/o ports rev. 3.00 sep 27, 2006 page 318 of 872 rej09b0325-0300 pin pin functions and selection method itu channel 3 settings (bit cmd1 in tfcr, bit ea3 in toer, bit pwm3 in tmdr, and bits ioa2 to ioa0 in tior3), bit nder8 in nderb, and bit pb 0 ddr in pbddr select the pin function as follows pb 0 /tp 8 / tioca 3 itu channel 3 settings (1) in table below (2) in table below pb 0 ddr ? 011 nder8 ?? 01 pb 0 input pb 0 output tp 8 output pin function tioca 3 output tioca 3 input * note: * tioca 3 input when cmd1 = pwm3 = 0 and ioa2 = 1. itu channel 3 settings (2) (2) (1) (2) (1) ea3 0 1 cmd1 ? 01 pwm3 ? 01 ? ioa2 ? 0001 ?? ioa1 ? 001 ??? ioa0 ? 01 ????
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 319 of 872 rej09b0325-0300 section 10 16-bit integrated timer unit (itu) 10.1 overview the h8/3048b group has a built-in 16-bit integrated timer unit (itu) with five 16-bit timer channels. when the itu is not used, it can be independently halted to conserve power. for details see section 20.6, module standby function. 10.1.1 features itu features are listed below. ? capability to process up to 12 pulse outputs or 10 pulse inputs ? ten general registers (grs, two per channel) with independently-assignable output compare or input capture functions ? selection of eight counter clock sources for each channel: internal clocks: , /2, /4, /8 external clocks: tclka, tclkb, tclkc, tclkd ? five operating modes selectable in all channels: ? waveform output by compare match selection of 0 output, 1 output, or toggle output (only 0 or 1 output in channel 2) ? input capture function rising edge, falling edge, or both edges (selectable) ? counter clearing function counters can be cleared by compare match or input capture ? synchronization two or more timer counters (tcnts) can be preset simultaneously, or cleared simultaneously by compare match or input capture. counter synchronization enables synchronous register input and output. ? pwm mode pwm output can be provided with an arbitrary duty cycle. with synchronization, up to five-phase pwm output is possible ? phase counting mode selectable in channel 2 two-phase encoder output can be counted automatically.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 320 of 872 rej09b0325-0300 ? three additional modes selectable in channels 3 and 4 ? reset-synchronized pwm mode if channels 3 and 4 are combined, three-phase pwm output is possible with three pairs of complementary waveforms. ? complementary pwm mode if channels 3 and 4 are combined, three-phase pwm output is possible with three pairs of non-overlapping complementary waveforms. ? buffering input capture registers can be double-buffered. output compare registers can be updated automatically. ? high-speed access via internal 16-bit bus the 16-bit timer counters, general registers, and buffer registers can be accessed at high speed via a 16-bit bus. ? fifteen interrupt sources each channel has two compare match/input capture interrupts and an overflow interrupt. all interrupts can be requested independently. ? activation of dma controller (dmac) four of the compare match/input capture interrupts from channels 0 to 3 can start the dmac. ? output triggering of programmable timing pattern controller (tpc) compare match/input capture signals from channels 0 to 3 can be used as tpc output triggers.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 321 of 872 rej09b0325-0300 table 10.1 summarizes the itu functions. table 10.1 itu functions item channel 0 channel 1 channel 2 channel 3 channel 4 clock sources internal clocks: , /2, /4, /8 external clocks: tclka, tclkb, tclkc, tclkd, selectable independently general registers (output compare/input capture registers) gra0, grb0 gra1, grb1 gra2, grb2 gra3, grb3 gra4, grb4 buffer registers???bra3, brb3bra4, brb4 input/output pins tioca 0 , tiocb 0 tioca 1 , tiocb 1 tioca 2 , tiocb 2 tioca 3 , tiocb 3 tioca 4 , tiocb 4 output pins ???? tocxa 4 , tocxb 4 counter clearing function gra0/grb0 compare match or input capture gra1/grb1 compare match or input capture gra2/grb2 compare match or input capture gra3/grb3 compare match or input capture gra4/grb4 compare match or input capture 0 ooooo 1 ooooo compare match output toggle oo ? oo input capture function ooooo synchronization ooooo pwm mode ooooo reset-synchronized pwm mode ??? oo complementary pwm mode ??? oo phase counting mode ? ? o ?? buffering ? ? ? oo dmac activation gra0 compare match or input capture gra1 compare match or input capture gra2 compare match or input capture gra3 compare match or input capture ? interrupt sources three sources  tch/input capture a0  compare match/input capture b0 overflow three sources  compare match/input capture a1  compare match/input capture b1 overflow three sources  compare match/input capture a2  compare match/input capture b2 overflow three sources  compare match/input capture a3  compare match/input capture b3 overflow three sources  compare match/input capture a4  compare match/input capture b4 overflow legend: o: available ?: not available
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 322 of 872 rej09b0325-0300 10.1.2 block diagrams itu block diagram (overall) figure 10.1 is a block diagram of the itu. 16-bit timer channel 4 16-bit timer channel 3 16-bit timer channel 2 16-bit timer channel 1 16-bit timer channel 0 module data bus bus interface internal data bus imia0 to imia4 imib0 to imib4 ovi0 to ovi4 tclka to tclkd figure 10.1 itu block diagram (overall)
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 323 of 872 rej09b0325-0300 block diagram of channels 0 and 1 itu channels 0 and 1 are functionally identical. both have the structure shown in figure 10.2. clock selector comparator control logic tclka to tclkd figure 10.2 block diagram of channels 0 and 1 (for channel 0)
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 324 of 872 rej09b0325-0300 block diagram of channel 2 figure 10.3 is a block diagram of channel 2. this is the channel that provides only 0 output and 1 output. clock selector comparator control logic tclka to tclkd figure 10.3 block diagram of channel 2
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 325 of 872 rej09b0325-0300 block diagrams of channels 3 and 4 figure 10.4 is a block diagram of channel 3. figure 10.5 is a block diagram of channel 4. tcnt3 bra3 legend: tcnt3: gra3, grb3: bra3, brb3: tcr3: tior3: tier3: tsr3: timer counter 3 (16 bits) general registers a3 and b3 (input capture/output compare registers) (16 bits 2) buffer registers a3 and b3 (input capture/output compare buffer registers) (16 bits 2) timer control register 3 (8 bits) clock selector comparator control logic gra3 brb3 grb3 tcr3 tior3 tier3 tsr3 tclka to tclkd figure 10.4 block diagram of channel 3
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 326 of 872 rej09b0325-0300 tcnt4 bra4 legend: tcnt4: gra4, grb4: bra4, brb4: tcr4: tior4: tier4: tsr4: timer counter 4 (16 bits) general registers a4 and b4 (input capture/output compare registers) (16 bits 2) buffer registers a4 and b4 (input capture/output compare buffer registers) (16 bits 2) timer control register 4 (8 bits) clock selector comparator control logic gra4 brb4 grb4 tcr4 tior4 tier4 tsr4 module data bus figure 10.5 block diagram of channel 4
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 327 of 872 rej09b0325-0300 10.1.3 input/output pins table 10.2 summarizes the itu pins. table 10.2 itu pins channel name abbre- viation input/ output function common clock input a tclka input external clock a input pin (phase-a input pin in phase counting mode) clock input b tclkb input external clock b input pin (phase-b input pin in phase counting mode) clock input c tclkc input external clock c input pin clock input d tclkd input external clock d input pin 0 input capture/output compare a0 tioca 0 input/ output gra0 output compare or input capture pin pwm output pin in pwm mode input capture/output compare b0 tiocb 0 input/ output grb0 output compare or input capture pin 1 input capture/output compare a1 tioca 1 input/ output gra1 output compare or input capture pin pwm output pin in pwm mode input capture/output compare b1 tiocb 1 input/ output grb1 output compare or input capture pin 2 input capture/output compare a2 tioca 2 input/ output gra2 output compare or input capture pin pwm output pin in pwm mode input capture/output compare b2 tiocb 2 input/ output grb2 output compare or input capture pin 3 input capture/output compare a3 tioca 3 input/ output gra3 output compare or input capture pin pwm output pin in pwm mode, complementary pwm mode, or reset-synchronized pwm mode input capture/output compare b3 tiocb 3 input/ output grb3 output compare or input capture pin pwm output pin in complementary pwm mode or reset-synchronized pwm mode 4 input capture/output compare a4 tioca 4 input/ output gra4 output compare or input capture pin pwm output pin in pwm mode, complementary pwm mode, or reset-synchronized pwm mode input capture/output compare b4 tiocb 4 input/ output grb4 output compare or input capture pin pwm output pin in complementary pwm mode or reset-synchronized pwm mode output compare xa4 tocxa 4 output pwm output pin in complementary pwm mode or reset-synchronized pwm mode output compare xb4 tocxb 4 output pwm output pin in complementary pwm mode or reset-synchronized pwm mode
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 328 of 872 rej09b0325-0300 10.1.4 register configuration table 10.3 summarizes the itu registers. table 10.3 itu registers channel address * 1 name abbre- viation r/w initial value common h'ff60 timer start register tstr r/w h'e0 h'ff61 timer synchro register tsnc r/w h'e0 h'ff62 timer mode register tmdr r/w h'80 h'ff63 timer function control register tfcr r/w h'c0 h'ff90 timer output master enable register toer r/w h'ff h'ff91 timer output control register tocr r/w h'ff 0 h'ff64 timer control register 0 tcr0 r/w h'80 h'ff65 timer i/o control register 0 tior0 r/w h'88 h'ff66 timer interrupt enable register 0 tier0 r/w h'f8 h'ff67 timer status register 0 tsr0 r/(w) * 2 h'f8 h'ff68 timer counter 0 (high) tcnt0h r/w h'00 h'ff69 timer counter 0 (low) tcnt0l r/w h'00 h'ff6a general register a0 (high) gra0h r/w h'ff h'ff6b general register a0 (low) gra0l r/w h'ff h'ff6c general register b0 (high) grb0h r/w h'ff h'ff6d general register b0 (low) grb0l r/w h'ff 1 h'ff6e timer control register 1 tcr1 r/w h'80 h'ff6f timer i/o control register 1 tior1 r/w h'88 h'ff70 timer interrupt enable register 1 tier1 r/w h'f8 h'ff71 timer status register 1 tsr1 r/(w) * 2 h'f8 h'ff72 timer counter 1 (high) tcnt1h r/w h'00 h'ff73 timer counter 1 (low) tcnt1l r/w h'00 h'ff74 general register a1 (high) gra1h r/w h'ff h'ff75 general register a1 (low) gra1l r/w h'ff h'ff76 general register b1 (high) grb1h r/w h'ff h'ff77 general register b1 (low) grb1l r/w h'ff
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 329 of 872 rej09b0325-0300 channel address * 1 name abbre- viation r/w initial value 2 h'ff78 timer control register 2 tcr2 r/w h'80 h'ff79 timer i/o control register 2 tior2 r/w h'88 h'ff7a timer interrupt enable register 2 tier2 r/w h'f8 h'ff7b timer status register 2 tsr2 r/(w) * 2 h'f8 h'ff7c timer counter 2 (high) tcnt2h r/w h'00 h'ff7d timer counter 2 (low) tcnt2l r/w h'00 h'ff7e general register a2 (high) gra2h r/w h'ff h'ff7f general register a2 (low) gra2l r/w h'ff h'ff80 general register b2 (high) grb2h r/w h'ff h'ff81 general register b2 (low) grb2l r/w h'ff 3 h'ff82 timer control register 3 tcr3 r/w h'80 h'ff83 timer i/o control register 3 tior3 r/w h'88 h'ff84 timer interrupt enable register 3 tier3 r/w h'f8 h'ff85 timer status register 3 tsr3 r/(w) * 2 h'f8 h'ff86 timer counter 3 (high) tcnt3h r/w h'00 h'ff87 timer counter 3 (low) tcnt3l r/w h'00 h'ff88 general register a3 (high) gra3h r/w h'ff h'ff89 general register a3 (low) gra3l r/w h'ff h'ff8a general register b3 (high) grb3h r/w h'ff h'ff8b general register b3 (low) grb3l r/w h'ff h'ff8c buffer register a3 (high) bra3h r/w h'ff h'ff8d buffer register a3 (low) bra3l r/w h'ff h'ff8e buffer register b3 (high) brb3h r/w h'ff h'ff8f buffer register b3 (low) brb3l r/w h'ff
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 330 of 872 rej09b0325-0300 channel address * 1 name abbre- viation r/w initial value 4 h'ff92 timer control register 4 tcr4 r/w h'80 h'ff93 timer i/o control register 4 tior4 r/w h'88 h'ff94 timer interrupt enable register 4 tier4 r/w h'f8 h'ff95 timer status register 4 tsr4 r/(w) * 2 h'f8 h'ff96 timer counter 4 (high) tcnt4h r/w h'00 h'ff97 timer counter 4 (low) tcnt4l r/w h'00 h'ff98 general register a4 (high) gra4h r/w h'ff h'ff99 general register a4 (low) gra4l r/w h'ff h'ff9a general register b4 (high) grb4h r/w h'ff h'ff9b general register b4 (low) grb4l r/w h'ff h'ff9c buffer register a4 (high) bra4h r/w h'ff h'ff9d buffer register a4 (low) bra4l r/w h'ff h'ff9e buffer register b4 (high) brb4h r/w h'ff h'ff9f buffer register b4 (low) brb4l r/w h'ff notes: 1. lower 16 bits of the address. 2. only 0 can be written, to clear flags.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 331 of 872 rej09b0325-0300 10.2 register descriptions 10.2.1 timer start register (tstr) tstr is an 8-bit readable/writable register that starts and stops the timer counter (tcnt) in channels 0 to 4. bit initial value read/write 7 ? ? ? ? ? ? reserved bits counter start 4 to 0 these bits start and stop tcnt4 to tcnt0 tstr is initialized to h'e0 by a reset and in standby mode. bits 7 to 5?reserved: read-only bits, always read as 1. bit 4?counter start 4 (str4): starts and stops timer counter 4 (tcnt4). bit 4: str4 description 0 tcnt4 is halted (initial value) 1 tcnt4 is counting bit 3?counter start 3 (str3): starts and stops timer counter 3 (tcnt3). bit 3: str3 description 0 tcnt3 is halted (initial value) 1 tcnt3 is counting bit 2?counter start 2 (str2): starts and stops timer counter 2 (tcnt2). bit 2: str2 description 0 tcnt2 is halted (initial value) 1 tcnt2 is counting
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 332 of 872 rej09b0325-0300 bit 1?counter start 1 (str1): starts and stops timer counter 1 (tcnt1). bit 1: str1 description 0 tcnt1 is halted (initial value) 1 tcnt1 is counting bit 0?counter start 0 (str0): starts and stops timer counter 0 (tcnt0). bit 0: str0 description 0 tcnt0 is halted (initial value) 1 tcnt0 is counting 10.2.2 timer synchro register (tsnc) tsnc is an 8-bit readable/writable register that selects whether channels 0 to 4 operate independently or synchronously. channels are synchronized by setting the corresponding bits to 1. bit initial value read/write 7 ? ? ? ? ? ? reserved bits timer sync 4 to 0 these bits synchronize channels 4 to 0 tsnc is initialized to h'e0 by a reset and in standby mode. bits 7 to 5?reserved: read-only bits, always read as 1. bit 4?timer sync 4 (sync4): selects whether channel 4 operates independently or synchronously. bit 4: sync4 description 0 channel 4 ? s timer counter (tcnt4) operates independently (initial value) tcnt4 is preset and cleared independently of other channels 1 channel 4 operates synchronously tcnt4 can be synchronously preset and cleared
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 333 of 872 rej09b0325-0300 bit 3?timer sync 3 (sync3): selects whether channel 3 operates independently or synchronously. bit 3: sync3 description 0 channel 3 ? s timer counter (tcnt3) operates independently (initial value) tcnt3 is preset and cleared independently of other channels 1 channel 3 operates synchronously tcnt3 can be synchronously preset and cleared bit 2?timer sync 2 (sync2): selects whether channel 2 operates independently or synchronously. bit 2: sync2 description 0 channel 2 ? s timer counter (tcnt2) operates independently (initial value) tcnt2 is preset and cleared independently of other channels 1 channel 2 operates synchronously tcnt2 can be synchronously preset and cleared bit 1?timer sync 1 (sync1): selects whether channel 1 operates independently or synchronously. bit 1: sync1 description 0 channel 1 ? s timer counter (tcnt1) operates independently (initial value) tcnt1 is preset and cleared independently of other channels 1 channel 1 operates synchronously tcnt1 can be synchronously preset and cleared bit 0?timer sync 0 (sync0): selects whether channel 0 operates independently or synchronously. bit 0: bit 0 description 0 channel 0 ? s timer counter (tcnt0) operates independently (initial value) tcnt0 is preset and cleared independently of other channels 1 channel 0 operates synchronously tcnt0 can be synchronously preset and cleared
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 334 of 872 rej09b0325-0300 10.2.3 timer mode register (tmdr) tmdr is an 8-bit readable/writable register that selects pwm mode for channels 0 to 4. it also selects phase counting mode and the overflow flag (ovf) setting conditions for channel 2. bit initial value read/write 7 ? ? reserved bit pwm mode 4 to 0 these bits select pwm mode for channels 4 to 0 phase counting mode flag selects phase counting mode for channel 2 flag direction selects the setting condition for the overflow flag (ovf) in timer status register 2 (tsr2) tmdr is initialized to h'80 by a reset and in standby mode. bit 7?reserved: read-only bit, always read as 1. bit 6?phase counting mode flag (mdf): selects whether channel 2 operates normally or in phase counting mode. bit 6: mdf description 0 channel 2 operates normally (initial value) 1 channel 2 operates in phase counting mode
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 335 of 872 rej09b0325-0300 when mdf is set to 1 to select phase counting mode, tcnt2 operates as an up/down-counter and pins tclka and tclkb become counter clock input pins. tcnt2 counts both rising and falling edges of tclka and tclkb, and counts up or down as follows. counting direction down-counting up-counting tclka pin in phase counting mode channel 2 operates as above regardless of the external clock edges selected by bits ckeg1 and ckeg0 and the clock source selected by bits tpsc2 to tpsc0 in tcr2. phase counting mode takes precedence over these settings. the counter clearing condition selected by the cclr1 and cclr0 bits in tcr2 and the compare match/input capture settings and interrupt functions of tior2, tier2, and tsr2 remain effective in phase counting mode. bit 5?flag direction (fdir): designates the setting condition for the ovf flag in tsr2. the fdir designation is valid in all modes in channel 2. bit 5: fdir description 0 ovf is set to 1 in tsr2 when tcnt2 overflows or underflows (initial value) 1 ovf is set to 1 in tsr2 when tcnt2 overflows bit 4?pwm mode 4 (pwm4): selects whether channel 4 operates normally or in pwm mode. bit 4: pwm4 description 0 channel 4 operates normally (initial value) 1 channel 4 operates in pwm mode when bit pwm4 is set to 1 to select pwm mode, pin tioca 4 becomes a pwm output pin. the output goes to 1 at compare match with gra4, and to 0 at compare match with grb4. if complementary pwm mode or reset-synchronized pwm mode is selected by bits cmd1 and cmd0 in tfcr, the cmd1 and cmd0 setting takes precedence and the pwm4 setting is ignored.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 336 of 872 rej09b0325-0300 bit 3?pwm mode 3 (pwm3): selects whether channel 3 operates normally or in pwm mode. bit 3: pwm3 description 0 channel 3 operates normally (initial value) 1 channel 3 operates in pwm mode when bit pwm3 is set to 1 to select pwm mode, pin tioca 3 becomes a pwm output pin. the output goes to 1 at compare match with gra3, and to 0 at compare match with grb3. if complementary pwm mode or reset-synchronized pwm mode is selected by bits cmd1 and cmd0 in tfcr, the cmd1 and cmd0 setting takes precedence and the pwm3 setting is ignored. bit 2?pwm mode 2 (pwm2): selects whether channel 2 operates normally or in pwm mode. bit 2: pwm2 description 0 channel 2 operates normally (initial value) 1 channel 2 operates in pwm mode when bit pwm2 is set to 1 to select pwm mode, pin tioca 2 becomes a pwm output pin. the output goes to 1 at compare match with gra2, and to 0 at compare match with grb2. bit 1?pwm mode 1 (pwm1): selects whether channel 1 operates normally or in pwm mode. bit 1: pwm1 description 0 channel 1 operates normally (initial value) 1 channel 1 operates in pwm mode when bit pwm1 is set to 1 to select pwm mode, pin tioca 1 becomes a pwm output pin. the output goes to 1 at compare match with gra1, and to 0 at compare match with grb1. bit 0?pwm mode 0 (pwm0): selects whether channel 0 operates normally or in pwm mode. bit 0: pwm0 description 0 channel 0 operates normally (initial value) 1 channel 0 operates in pwm mode when bit pwm0 is set to 1 to select pwm mode, pin tioca 0 becomes a pwm output pin. the output goes to 1 at compare match with gra0, and to 0 at compare match with grb0.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 337 of 872 rej09b0325-0300 10.2.4 timer function control register (tfcr) tfcr is an 8-bit readable/writable register that selects complementary pwm mode, reset- synchronized pwm mode, and buffering for channels 3 and 4. bit initial value read/write 7 ? ? ? ? reserved bits combination mode 1/0 these bits select complementary pwm mode or reset-synchronized pwm mode for channels 3 and 4 buffer mode b4 and a4 these bits select buffering of general registers (grb4 and gra4) by buffer registers (brb4 and bra4) in channel 4 buffer mode b3 and a3 these bits select buffering of general registers (grb3 and gra3) by buffer registers (brb3 and bra3) in channel 3 tfcr is initialized to h'c0 by a reset and in standby mode. bits 7 and 6?reserved: read-only bits, always read as 1. bits 5 and 4?combination mode 1 and 0 (cmd1, cmd0): these bits select whether channels 3 and 4 operate in normal mode, complementary pwm mode, or reset-synchronized pwm mode. bit 5: cmd1 bit 4: cmd0 description 00 1 channels 3 and 4 operate normally (initial value) 1 0 channels 3 and 4 operate together in complementary pwm mode 1 channels 3 and 4 operate together in reset-synchronized pwm mode
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 338 of 872 rej09b0325-0300 before selecting reset-synchronized pwm mode or complementary pwm mode, halt the timer counter or counters that will be used in these modes. when these bits select complementary pwm mode or reset-synchronized pwm mode, they take precedence over the setting of the pwm mode bits (pwm4 and pwm3) in tmdr. settings of complementary pwm mode or reset-synchronized pwm mode and settings of timer sync bits sync4 and sync3 in tsnc are valid simultaneously, however, when complementary pwm mode is selected, channels 3 and 4 must not be synchronized (do not set bits sync3 and sync4 both to 1 in tsnc). bit 3?buffer mode b4 (bfb4): selects whether grb4 operates normally in channel 4, or whether grb4 is buffered by brb4. bit 3: bfb4 description 0 grb4 operates normally (initial value) 1 grb4 is buffered by brb4 bit 2?buffer mode a4 (bfa4): selects whether gra4 operates normally in channel 4, or whether gra4 is buffered by bra4. bit 2: bfa4 description 0 gra4 operates normally (initial value) 1 gra4 is buffered by bra4 bit 1?buffer mode b3 (bfb3): selects whether grb3 operates normally in channel 3, or whether grb3 is buffered by brb3. bit 1: bfb3 description 0 grb3 operates normally (initial value) 1 grb3 is buffered by brb3 bit 0?buffer mode a3 (bfa3): selects whether gra3 operates normally in channel 3, or whether gra3 is buffered by bra3. bit 0: bfa3 description 0 gra3 operates normally (initial value) 1 gra3 is buffered by bra3
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 339 of 872 rej09b0325-0300 10.2.5 timer output master enable register (toer) toer is an 8-bit readable/writable register that enables or disables output settings for channels 3 and 4. bit initial value read/write 7 ? ? ? ? reserved bits master enable tocxa4, tocxb4 these bits enable or disable output settings for pins tocxa 4 and tocxb 4 master enable tioca3, tiocb3 , tioca4, tiocb4 these bits enable or disable output settings for pins tioca 3 , tiocb 3 , tioca 4 , and tiocb 4 toer is initialized to h'ff by a reset and in standby mode. bits 7 and 6?reserved: read-only bits, always read as 1. bit 5?master enable tocxb4 (exb4): enables or disables itu output at pin tocxb 4 . bit 5: exb4 description 0tocxb 4 output is disabled regardless of tfcr settings (tocxb 4 operates as a generic input/output pin). if xtgd = 0, exb4 is cleared to 0 when input capture a occurs in channel 1. 1tocxb 4 is enabled for output according to tfcr settings (initial value) bit 4?master enable tocxa4 (exa4): enables or disables itu output at pin tocxa 4 . bit 4: exa4 description 0tocxa 4 output is disabled regardless of tfcr settings (tocxa 4 operates as a generic input/output pin). if xtgd = 0, exa4 is cleared to 0 when input capture a occurs in channel 1. 1tocxa 4 is enabled for output according to tfcr settings (initial value)
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 340 of 872 rej09b0325-0300 bit 3?master enable tiocb3 (eb3): enables or disables itu output at pin tiocb 3 . bit 3: eb3 description 0tiocb 3 output is disabled regardless of tior3 and tfcr settings (tiocb 3 operates as a generic input/output pin). if xtgd = 0, eb3 is cleared to 0 when input capture a occurs in channel 1. 1tiocb 3 is enabled for output according to tior3 and tfcr settings (initial value) bit 2?master enable tiocb4 (eb4): enables or disables itu output at pin tiocb 4 . bit 2: eb4 description 0tiocb 4 output is disabled regardless of tior4 and tfcr settings (tiocb 4 operates as a generic input/output pin). if xtgd = 0, eb4 is cleared to 0 when input capture a occurs in channel 1. 1tiocb 4 is enabled for output according to tior4 and tfcr settings (initial value) bit 1?master enable tioca4 (ea4): enables or disables itu output at pin tioca 4 . bit 1: ea4 description 0tioca 4 output is disabled regardless of tior4, tmdr, and tfcr settings (tioca 4 operates as a generic input/output pin). if xtgd = 0, ea4 is cleared to 0 when input capture a occurs in channel 1. 1tioca 4 is enabled for output according to tior4, tmdr, and tfcr settings (initial value) bit 0?master enable tioca3 (ea3): enables or disables itu output at pin tioca 3 . bit 0: ea3 description 0tioca 3 output is disabled regardless of tior3, tmdr, and tfcr settings (tioca 3 operates as a generic input/output pin). if xtgd = 0, ea3 is cleared to 0 when input capture a occurs in channel 1. 1tioca 3 is enabled for output according to tior3, tmdr, and tfcr settings (initial value)
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 341 of 872 rej09b0325-0300 10.2.6 timer output control register (tocr) tocr is an 8-bit readable/writable register that selects externally triggered disabling of output in complementary pwm mode and reset-synchronized pwm mode, and inverts the output levels. bit initial value read/write 7 ? ? ? ? ? ? ? ? ? ? reserved bits output level select 3, 4 these bits select output levels in complementary pwm mode and reset- synchronized pwm mode external trigger disable selects externally triggered disabling of output in complementary pwm mode and reset-synchronized pwm mode reserved bits the settings of the xtgd, ols4, and ols3 bits are valid only in complementary pwm mode and reset-synchronized pwm mode. these settings do not affect other modes. tocr is initialized to h'ff by a reset and in standby mode. bits 7 to 5?reserved: read-only bits, always read as 1. bit 4?external trigger disable (xtgd): selects externally triggered disabling of itu output in complementary pwm mode and reset-synchronized pwm mode. bit 4: xtgd description 0 input capture a in channel 1 is used as an external trigger signal in complementary pwm mode and reset-synchronized pwm mode. when an external trigger occurs, bits 5 to 0 in toer are cleared to 0, disabling itu output. 1 external triggering is disabled (initial value) bits 3 and 2?reserved: read-only bits, always read as 1.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 342 of 872 rej09b0325-0300 bit 1?output level select 4 (ols4): selects output levels in complementary pwm mode and reset-synchronized pwm mode. bit 1: ols4 description 0tioca 3 , tioca 4 , and tiocb 4 outputs are inverted 1tioca 3 , tioca 4 , and tiocb 4 outputs are not inverted (initial value) bit 0?output level select 3 (ols3): selects output levels in complementary pwm mode and reset-synchronized pwm mode. bit 0: ols3 description 0tiocb 3 , tocxa 4 , and tocxb 4 outputs are inverted 1tiocb 3 , tocxa 4 , and tocxb 4 outputs are not inverted (initial value) 10.2.7 timer counters (tcnt) tcnt is a 16-bit counter. the itu has five tcnts, one for each channel. channel abbreviation function 0 tcnt0 1 tcnt1 up-counter 2 tcnt2 phase counting mode: up/down-counter other modes: up-counter 3 tcnt3 4 tcnt4 complementary pwm mode: up/down-counter other modes: up-counter bit initial value read/write 14 0 r/w 12 0 r/w 10 0 r/w 8 0 r/w 6 0 r/w 0 0 r/w 4 0 r/w 2 0 r/w 15 0 r/w 13 0 r/w 11 0 r/w 9 0 r/w 7 0 r/w 1 0 r/w 5 0 r/w 3 0 r/w each tcnt is a 16-bit readable/writable register that counts pulse inputs from a clock source. the clock source is selected by bits tpsc2 to tpsc0 in tcr. tcnt0 and tcnt1 are up-counters. tcnt2 is an up/down-counter in phase counting mode and an up-counter in other modes. tcnt3 and tcnt4 are up/down-counters in complementary pwm mode and up-counters in other modes.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 343 of 872 rej09b0325-0300 tcnt can be cleared to h'0000 by compare match with gra or grb or by input capture to gra or grb (counter clearing function) in the same channel. when tcnt overflows (changes from h'ffff to h'0000), the ovf flag is set to 1 in tsr of the corresponding channel. when tcnt underflows (changes from h'0000 to h'ffff), the ovf flag is set to 1 in tsr of the corresponding channel. the tcnts are linked to the cpu by an internal 16-bit bus and can be written or read by either word access or byte access. each tcnt is initialized to h'0000 by a reset and in standby mode. 10.2.8 general registers a, b (gra, grb) the general registers are 16-bit registers. the itu has 10 general registers, two in each channel. channel abbreviation function 0gra0, grb0 1gra1, grb1 2gra2, grb2 output compare/input capture register 3gra3, grb3 4gra4, grb4 output compare/input capture register; can be buffered by buffer registers bra and brb bit initial value read/write 14 1 r/w 12 1 r/w 10 1 r/w 8 1 r/w 6 1 r/w 0 1 r/w 4 1 r/w 2 1 r/w 15 1 r/w 13 1 r/w 11 1 r/w 9 1 r/w 7 1 r/w 1 1 r/w 5 1 r/w 3 1 r/w a general register is a 16-bit readable/writable register that can function as either an output compare register or an input capture register. the function is selected by settings in tior. when a general register is used as an output compare register, its value is constantly compared with the tcnt value. when the two values match (compare match), the imfa or imfb flag is set to 1 in tsr. compare match output can be selected in tior. when a general register is used as an input capture register, rising edges, falling edges, or both edges of an external input capture signal are detected and the current tcnt value is stored in the
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 344 of 872 rej09b0325-0300 general register. the corresponding imfa or imfb flag in tsr is set to 1 at the same time. the valid edge or edges of the input capture signal are selected in tior. tior settings are ignored in pwm mode, complementary pwm mode, and reset-synchronized pwm mode. general registers are linked to the cpu by an internal 16-bit bus and can be written or read by either word access or byte access. general registers are initialized to the output compare function (with no output signal) by a reset and in standby mode. the initial value is h'ffff. 10.2.9 buffer registers a, b (bra, brb) the buffer registers are 16-bit registers. the itu has four buffer registers, two each in channels 3 and 4. channel abbreviation function 3 bra3, brb3 4 bra4, brb4 used for buffering ? when the corresponding gra or grb functions as an output compare register, bra or brb can function as an output compare buffer register: the bra or brb value is automatically transferred to gra or grb at compare match ? when the corresponding gra or grb functions as an input capture register, bra or brb can function as an input capture buffer register: the gra or grb value is automatically transferred to bra or brb at input capture bit initial value read/write 14 1 r/w 12 1 r/w 10 1 r/w 8 1 r/w 6 1 r/w 0 1 r/w 4 1 r/w 2 1 r/w 15 1 r/w 13 1 r/w 11 1 r/w 9 1 r/w 7 1 r/w 1 1 r/w 5 1 r/w 3 1 r/w a buffer register is a 16-bit readable/writable register that is used when buffering is selected. buffering can be selected independently by bits bfb4, bfa4, bfb3, and bfa3 in tfcr. the buffer register and general register operate as a pair. when the general register functions as an output compare register, the buffer register functions as an output compare buffer register. when
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 345 of 872 rej09b0325-0300 the general register functions as an input capture register, the buffer register functions as an input capture buffer register. the buffer registers are linked to the cpu by an internal 16-bit bus and can be written or read by either word or byte access. buffer registers are initialized to h'ffff by a reset and in standby mode. 10.2.10 timer control registers (tcr) tcr is an 8-bit register. the itu has five tcrs, one in each channel. channel abbreviation function 0 tcr0 1 tcr1 2 tcr2 3 tcr3 4 tcr4 tcr controls the timer counter. the tcrs in all channels are functionally identical. when phase counting mode is selected in channel 2, the settings of bits ckeg1 and ckeg0 and tpsc2 to tpsc0 in tcr2 are ignored. bit initial value read/write 7 ? ? timer prescaler 2 to 0 these bits select the counter clock reserved bit clock edge 1, 0 these bits select external clock edges counter clear 1, 0 these bits select the counter clear source each tcr is an 8-bit readable/writable register that selects the timer counter clock source, selects the edge or edges of external clock sources, and selects how the counter is cleared. tcr is initialized to h'80 by a reset and in standby mode. bit 7?reserved: read-only bit, always read as 1.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 346 of 872 rej09b0325-0300 bits 6 and 5?counter clear 1 and 0 (cclr1, cclr0): these bits select how tcnt is cleared. bit 6: cclr1 bit 5: cclr0 description 0 0 tcnt is not cleared (initial value) 1 tcnt is cleared by gra compare match or input capture * 1 1 0 tcnt is cleared by grb compare match or input capture * 1 1 synchronous clear: tcnt is cleared in synchronization with other synchronized timers * 2 notes: 1. tcnt is cleared by compare match when the general register functions as an output compare register, and by input capture when the general register functions as an input capture register. 2. selected in tsnc. bits 4 and 3?clock edge 1 and 0 (ckeg1, ckeg0): these bits select external clock input edges when an external clock source is used. bit 4: ckeg1 bit 3: ckeg0 description 0 0 count rising edges (initial value) 1 count falling edges 1 ? count both edges when channel 2 is set to phase counting mode, bits ckeg1 and ckeg0 in tcr2 are ignored. phase counting takes precedence.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 347 of 872 rej09b0325-0300 bits 2 to 0?timer prescaler 2 to 0 (tpsc2 to tpsc0): these bits select the counter clock source. bit 2: tpsc2 bit 1: tpsc1 bit 0: tpsc0 description 0 0 0 internal clock: when bit tpsc2 is cleared to 0 an internal clock source is selected, and the timer counts only falling edges. when bit tpsc2 is set to 1 an external clock source is selected, and the timer counts the edge or edges selected by bits ckeg1 and ckeg0. when channel 2 is set to phase counting mode (mdf = 1 in tmdr), the settings of bits tpsc2 to tpsc0 in tcr2 are ignored. phase counting takes precedence.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 348 of 872 rej09b0325-0300 10.2.11 timer i/o control register (tior) tior is an 8-bit register. the itu has five tiors, one in each channel. channel abbreviation function 0tior0 1tior1 2tior2 3tior3 4tior4 tior controls the general registers. some functions differ in pwm mode. tior3 and tior4 settings are ignored when complementary pwm mode or reset-synchronized pwm mode is selected in channels 3 and 4. bit initial value read/write 7 ? ? ? ? i/o control a2 to a0 these bits select gra functions reserved bit i/o control b2 to b0 these bits select grb functions reserved bit each tior is an 8-bit readable/writable register that selects the output compare or input capture function for gra and grb, and specifies the functions of the tioca and tiocb pins. if the output compare function is selected, tior also selects the type of output. if input capture is selected, tior also selects the edge or edges of the input capture signal. tior is initialized to h'88 by a reset and in standby mode. bit 7?reserved: read-only bit, always read as 1.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 349 of 872 rej09b0325-0300 bits 6 to 4?i/o control b2 to b0 (iob2 to iob0): these bits select the grb function. bit 6: iob2 bit 5: iob1 bit 4: iob0 description 0 0 0 no output at compare match (initial value) 1 0 output at grb compare match * 1 1 0 1 output at grb compare match * 1 1 grb is an output compare register output toggles at grb compare match (1 output in channel 2) * 1 * 2 1 0 0 grb captures rising edge of input 1 grb captures falling edge of input 10 1 grb is an input capture register grb captures both edges of input notes: 1. after a reset, the output is 0 until the first compare match. 2. channel 2 output cannot be toggled by compare match. this setting selects 1 output instead. bit 3?reserved: read-only bit, always read as 1. bits 2 to 0?i/o control a2 to a0 (ioa2 to ioa0): these bits select the gra function. bit 2: ioa2 bit 1: ioa1 bit 0: ioa0 description 0 0 0 no output at compare match (initial value) 1 0 output at gra compare match * 1 1 0 1 output at gra compare match * 1 1 gra is an output compare register output toggles at gra compare match (1 output in channel 2) * 1 * 2 1 0 0 gra captures rising edge of input 1 gra captures falling edge of input 10 1 gra is an input capture register gra captures both edges of input notes: 1. after a reset, the output is 0 until the first compare match. 2. channel 2 output cannot be toggled by compare match. this setting selects 1 output instead.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 350 of 872 rej09b0325-0300 10.2.12 timer status register (tsr) tsr is an 8-bit register. the itu has five tsrs, one in each channel. channel abbreviation function 0tsr0 1tsr1 2tsr2 3tsr3 4tsr4 indicates input capture, compare match, and overflow status bit initial value read/write 7 ? ? ? ? ? ? ? ? ? ? * 2 ovf 0 r/(w) reserved bits note: * only 0 can be written, to clear the flag. * 1 imfb 0 r/(w) * 0 imfa 0 r/(w) overflow flag status flag indicating overflow or underflow input capture/compare match flag b status flag indicating grb compare match or input capture input capture/compare match flag a status flag indicating gra compare match or input capture each tsr is an 8-bit readable/writable register containing flags that indicate tcnt overflow or underflow and gra or grb compare match or input capture. these flags are interrupt sources and generate cpu interrupts if enabled by corresponding bits in tier. tsr is initialized to h'f8 by a reset and in standby mode. bits 7 to 3?reserved: read-only bits, always read as 1.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 351 of 872 rej09b0325-0300 bit 2?overflow flag (ovf): this status flag indicates tcnt overflow or underflow. bit 2: ovf description 0 [clearing condition] (initial value) read ovf when ovf = 1, then write 0 in ovf 1 [setting condition] tcnt overflowed from h'ffff to h'0000, or underflowed from h'0000 to h'ffff * note: * tcnt underflow occurs when tcnt operates as an up/down-counter. underflow occurs only under the following conditions: (1) channel 2 operates in phase counting mode (mdf = 1 in tmdr) (2) channels 3 and 4 operate in complementary pwm mode (cmd1 = 1 and cmd0 = 0 in tfcr) bit 1?input capture/compare match flag b (imfb): this status flag indicates grb compare match or input capture events. bit 1: imfb description 0 [clearing condition] (initial value) read imfb when imfb = 1, then write 0 in imfb 1 [setting conditions] tcnt = grb when grb functions as an output compare register. tcnt value is transferred to grb by an input capture signal, when grb functions as an input capture register. bit 0?input capture/compare match flag a (imfa): this status flag indicates gra compare match or input capture events. bit 0: imfa description 0 [clearing conditions] (initial value) read imfa when imfa = 1, then write 0 in imfa. dmac activated by imia interrupt (channels 0 to 3 only). 1 [setting conditions] tcnt = gra when gra functions as an output compare register. tcnt value is transferred to gra by an input capture signal, when gra functions as an input capture register.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 352 of 872 rej09b0325-0300 10.2.13 timer interrupt enable register (tier) tier is an 8-bit register. the itu has five tiers, one in each channel. channel abbreviation function 0tier0 1tier1 2tier2 3tier3 4tier4 enables or disables interrupt requests. bit initial value read/write 7 ? ? ? ? ? ? ? ? ? ? reserved bits overflow interrupt enable enables or disables ovf interrupts input capture/compare match interrupt enable b enables or disables imfb interrupts input capture/compare match interrupt enable a enables or disables imfa interrupts each tier is an 8-bit readable/writable register that enables and disables overflow interrupt requests and general register compare match and input capture interrupt requests. tier is initialized to h'f8 by a reset and in standby mode. bits 7 to 3?reserved: read-only bits, always read as 1.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 353 of 872 rej09b0325-0300 bit 2?overflow interrupt enable (ovie): enables or disables the interrupt requested by the ovf flag in tsr when ovf is set to 1. bit 2: ovie description 0 ovi interrupt requested by ovf is disabled (initial value) 1 ovi interrupt requested by ovf is enabled bit 1?input capture/compare match interrupt enable b (imieb): enables or disables the interrupt requested by the imfb flag in tsr when imfb is set to 1. bit 1: imieb description 0 imib interrupt requested by imfb is disabled (initial value) 1 imib interrupt requested by imfb is enabled bit 0?input capture/compare match interrupt enable a (imiea): enables or disables the interrupt requested by the imfa flag in tsr when imfa is set to 1. bit 0: imiea description 0 imia interrupt requested by imfa is disabled (initial value) 1 imia interrupt requested by imfa is enabled 10.3 cpu interface 10.3.1 16-bit accessible registers the timer counters (tcnts), general registers a and b (gras and grbs), and buffer registers a and b (bras and brbs) are 16-bit registers, and are linked to the cpu by an internal 16-bit data bus. these registers can be written or read a word at a time, or a byte at a time. figures 10.6 and 10.7 show examples of word access to a timer counter (tcnt). figures 10.8 to 10.11 show examples of byte access to tcnth and tcntl.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 354 of 872 rej09b0325-0300 on-chip data bus cpu h l bus interface h l module data bus tcnth tcntl figure 10.6 access to timer counter (cpu writes to tcnt, word) on-chip data bus cpu h l bus interface h l module data bus tcnth tcntl figure 10.7 access to timer counter (cpu reads tcnt, word) on-chip data bus cpu h l bus interface h l module data bus tcnth tcntl figure 10.8 access to timer counter (cpu writes to tcnt, upper byte)
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 355 of 872 rej09b0325-0300 on-chip data bus cpu h l bus interface h l module data bus tcnth tcntl figure 10.9 access to timer counter (cpu writes to tcnt, lower byte) on-chip data bus cpu h l bus interface h l module data bus tcnth tcntl figure 10.10 access to timer counter (cpu reads tcnt, upper byte) on-chip data bus cpu h l bus interface h l module data bus tcnth tcntl figure 10.11 access to timer counter (cpu reads tcnt, lower byte)
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 356 of 872 rej09b0325-0300 10.3.2 8-bit accessible registers the registers other than the timer counters, general registers, and buffer registers are 8-bit registers. these registers are linked to the cpu by an internal 8-bit data bus. figures 10.12 and 10.13 show examples of byte read and write access to a tcr. if a word-size data transfer instruction is executed, two byte transfers are performed. on-chip data bus cpu h l bus interface h l module data bus tcr figure 10.12 access to timer counter (cpu writes to tcr) on-chip data bus cpu h l bus interface h l module data bus tcr figure 10.13 access to timer counter (cpu reads tcr)
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 357 of 872 rej09b0325-0300 10.4 operation 10.4.1 overview a summary of operations in the various modes is given below. normal operation each channel has a timer counter and general registers. the timer counter counts up, and can operate as a free-running counter, periodic counter, or external event counter. general registers a and b can be used for input capture or output compare. synchronous operation the timer counters in designated channels are preset synchronously. data written to the timer counter in any one of these channels is simultaneously written to the timer counters in the other channels as well. the timer counters can also be cleared synchronously if so designated by the cclr1 and cclr0 bits in the tcrs. pwm mode a pwm waveform is output from the tioca pin. the output goes to 1 at compare match a and to 0 at compare match b. the duty cycle can be varied from 0% to 100% depending on the settings of gra and grb. when a channel is set to pwm mode, its gra and grb automatically become output compare registers. reset-synchronized pwm mode channels 3 and 4 are paired for three-phase pwm output with complementary waveforms. (the three phases are related by having a common transition point.) when reset-synchronized pwm mode is selected gra3, grb3, gra4, and grb4 automatically function as output compare registers, tioca 3 , tiocb 3 , tioca 4 , tocxa 4 , tiocb 4 , and tocxb 4 function as pwm output pins, and tcnt3 operates as an up-counter. tcnt4 operates independently, and is not compared with gra4 or grb4.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 358 of 872 rej09b0325-0300 complementary pwm mode channels 3 and 4 are paired for three-phase pwm output with non-overlapping complementary waveforms. when complementary pwm mode is selected gra3, grb3, gra4, and grb4 automatically function as output compare registers, and tioca 3 , tiocb 3 , tioca 4 , tocxa 4 , tiocb 4 , and tocxb 4 function as pwm output pins. tcnt3 and tcnt4 operate as up/down- counters. phase counting mode the phase relationship between two clock signals input at tclka and tclkb is detected and tcnt2 counts up or down accordingly. when phase counting mode is selected tclka and tclkb become clock input pins and tcnt2 operates as an up/down-counter. buffering ? if the general register is an output compare register when compare match occurs the buffer register value is transferred to the general register. ? if the general register is an input capture register when input capture occurs the tcnt value is transferred to the general register, and the previous general register value is transferred to the buffer register. ? complementary pwm mode the buffer register value is transferred to the general register when tcnt3 and tcnt4 change counting direction. ? reset-synchronized pwm mode the buffer register value is transferred to the general register at gra3 compare match.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 359 of 872 rej09b0325-0300 10.4.2 basic functions counter operation when one of bits str0 to str4 is set to 1 in the timer start register (tstr), the timer counter (tcnt) in the corresponding channel starts counting. the counting can be free-running or periodic. sample setup procedure for counter: figure 10.14 shows a sample procedure for setting up a counter. counter setup select counter clock type of counting? periodic counting no yes select counter clear source select output compare register function set period start counter free-running counting start counter periodic counter free-running counter 1 2 3 4 55 figure 10.14 counter setup procedure (example)
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 360 of 872 rej09b0325-0300 1. set bits tpsc2 to tpsc0 in tcr to select the counter clock source. if an external clock source is selected, set bits ckeg1 and ckeg0 in tcr to select the desired edge(s) of the external clock signal. 2. for periodic counting, set cclr1 and cclr0 in tcr to have tcnt cleared at gra compare match or grb compare match. 3. set tior to select the output compare function of gra or grb, whichever was selected in step 2. 4. write the count period in gra or grb, whichever was selected in step 2. 5. set the str bit to 1 in tstr to start the timer counter. free-running and periodic counter operation: a reset leaves the counters (tcnts) in itu channels 0 to 4 all set as free-running counters. a free-running counter starts counting up when the corresponding bit in tstr is set to 1. when the count overflows from h'ffff to h'0000, the ovf flag is set to 1 in tsr. if the corresponding ovie bit is set to 1 in tier, a cpu interrupt is requested. after the overflow, the counter continues counting up from h'0000. figure 10.15 illustrates free-running counting. tcnt value h'ffff h'0000 str0 to str4 bit ovf time figure 10.15 free-running counter operation when a channel is set to have its counter cleared by compare match, in that channel tcnt operates as a periodic counter. select the output compare function of gra or grb, set bit cclr1 or cclr0 in tcr to have the counter cleared by compare match, and set the count period in gra or grb. after these settings, the counter starts counting up as a periodic counter when the corresponding bit is set to 1 in tstr. when the count matches gra or grb, the imfa or imfb flag is set to 1 in tsr and the counter is cleared to h'0000. if the corresponding imiea or imieb bit is set to 1 in tier, a cpu interrupt is requested at this time. after the compare match, tcnt continues counting up from h'0000. figure 10.16 illustrates periodic counting.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 361 of 872 rej09b0325-0300 tcnt value gr h'0000 str bit imf time counter cleared by general register compare match figure 10.16 periodic counter operation tcnt count timing: ? internal clock source bits tpsc2 to tpsc0 in tcr select the system clock ( ) or one of three internal clock sources obtained by prescaling the system clock ( /2, /4, /8). figure 10.17 shows the timing. ? 1 n n + 1 figure 10.17 count timing for internal clock sources ? external clock source bits tpsc2 to tpsc0 in tcr select an external clock input pin (tclka to tclkd), and its valid edge or edges are selected by bits ckeg1 and ckeg0. the rising edge, falling edge, or both edges can be selected. the pulse width of the external clock signal must be at least 1.5 system clocks when a single edge is selected, and at least 2.5 system clocks when both edges are selected. shorter pulses will not be counted correctly. figure 10.18 shows the timing when both edges are detected.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 362 of 872 rej09b0325-0300 ? 1 n n + 1 figure 10.18 count timing for external clock sources (when both edges are detected) waveform output by compare match in itu channels 0, 1, 3, and 4, compare match a or b can cause the output at the tioca or tiocb pin to go to 0, go to 1, or toggle. in channel 2 the output can only go to 0 or go to 1. sample setup procedure for waveform output by compare match: figure 10.19 shows a sample procedure for setting up waveform output by compare match. output setup select waveform output mode set output timing start counter waveform output select the compare match output mode (0, 1, or toggle) in tior. when a waveform output mode is selected, the pin switches from its generic input/ output function to the output compare function (tioca or tiocb). an output compare pin outputs set a value in gra or grb to designate the compare match timing. set the str bit to 1 in tstr to start the timer counter. 1 2 3 0 until the first compare match occurs. 1. 2. 3. figure 10.19 setup procedure for waveform output by compare match (example)
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 363 of 872 rej09b0325-0300 examples of waveform output: figure 10.20 shows examples of 0 and 1 output. tcnt operates as a free-running counter, 0 output is selected for compare match a, and 1 output is selected for compare match b. when the pin is already at the selected output level, the pin level does not change. time h'ffff grb tiocb tioca gra no change no change no change no change 1 output 0 output tcnt value h'0000 figure 10.20 0 and 1 output (examples) figure 10.21 shows examples of toggle output. tcnt operates as a periodic counter, cleared by compare match b. toggle output is selected for both compare match a and b. grb tiocb tioca gra tcnt value time counter cleared by compare match with grb toggle output toggle output h'0000 figure 10.21 toggle output (example)
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 364 of 872 rej09b0325-0300 output compare timing: the compare match signal is generated in the last state in which tcnt and the general register match (when tcnt changes from the matching value to the next value). when the compare match signal is generated, the output value selected in tior is output at the output compare pin (tioca or tiocb). when tcnt matches a general register, the compare match signal is not generated until the next counter clock pulse. figure 10.22 shows the output compare timing. n + 1 n n figure 10.22 output compare timing input capture function the tcnt value can be captured into a general register when a transition occurs at an input capture/output compare pin (tioca or tiocb). capture can take place on the rising edge, falling edge, or both edges. the input capture function can be used to measure pulse width or period. sample setup procedure for input capture: figure 10.23 shows a sample procedure for setting up input capture.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 365 of 872 rej09b0325-0300 input selection select input-capture input start counter input capture set tior to select the input capture function of a general register and the rising edge, falling edge, or both edges of the input capture signal. clear the port data direction bit to 0 before making these tior settings. set the str bit to 1 in tstr to start the timer counter. 1 2 1. 2. figure 10.23 setup procedure for input capture (example) examples of input capture: figure 10.24 illustrates input capture when the falling edge of tiocb and both edges of tioca are selected as capture edges. tcnt is cleared by input capture into grb. h'0005 h'0180 time h'0180 h'0160 h'0005 h'0000 tiocb tioca gra grb counter cleared by tiocb input (falling edge) tcnt value h'0160 figure 10.24 input capture (example)
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 366 of 872 rej09b0325-0300 input capture signal timing: input capture on the rising edge, falling edge, or both edges can be selected by settings in tior. figure 10.25 shows the timing when the rising edge is selected. the pulse width of the input capture signal must be at least 1.5 system clocks for single-edge capture, and 2.5 system clocks for capture of both edges. n n figure 10.25 input capture signal timing
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 367 of 872 rej09b0325-0300 10.4.3 synchronization the synchronization function enables two or more timer counters to be synchronized by writing the same data to them simultaneously (synchronous preset). with appropriate tcr settings, two or more timer counters can also be cleared simultaneously (synchronous clear). synchronization enables additional general registers to be associated with a single time base. synchronization can be selected for all channels (0 to 4). sample setup procedure for synchronization figure 10.26 shows a sample procedure for setting up synchronization. setup for synchronization synchronous preset set the sync bits to 1 in tsnc for the channels to be synchronized. when a value is written in tcnt in one of the synchronized channels, the same value is simultaneously written in tcnt in the other channels (synchronized preset). 1. 2. 2 3 1 5 4 5 select synchronization synchronous preset write to tcnt synchronous clear clearing synchronized to this channel? select counter clear source start counter counter clear synchronous clear start counter select counter clear source yes no set the cclr1 or cclr0 bit in tcr to have the counter cleared by compare match or input capture. set the cclr1 and cclr0 bits in tcr to have the counter cleared synchronously. set the str bits in tstr to 1 to start the synchronized counters. 3. 4. 5. figure 10.26 setup procedure for synchronization (example)
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 368 of 872 rej09b0325-0300 example of synchronization figure 10.27 shows an example of synchronization. channels 0, 1, and 2 are synchronized, and are set to operate in pwm mode. channel 0 is set for counter clearing by compare match with grb0. channels 1 and 2 are set for synchronous counter clearing. the timer counters in channels 0, 1, and 2 are synchronously preset, and are synchronously cleared by compare match with grb0. a three-phase pwm waveform is output from pins tioca 0 , tioca 1 , and tioca 2 . for further information on pwm mode, see section 10.4.4, pwm mode. tioca 2 time tioca 1 tioca 0 gra2 gra1 grb2 gra0 grb1 grb0 value of tcnt0 to tcnt2 cleared by compare match with grb0 h'0000 figure 10.27 synchronization (example)
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 369 of 872 rej09b0325-0300 10.4.4 pwm mode in pwm mode gra and grb are paired and a pwm waveform is output from the tioca pin. gra specifies the time at which the pwm output changes to 1. grb specifies the time at which the pwm output changes to 0. if either gra or grb is selected as the counter clear source, a pwm waveform with a duty cycle from 0% to 100% is output at the tioca pin. pwm mode can be selected in all channels (0 to 4). table 10.4 summarizes the pwm output pins and corresponding registers. if the same value is set in gra and grb, the output does not change when compare match occurs. table 10.4 pwm output pins and registers channel output pin 1 output 0 output 0tioca 0 gra0 grb0 1tioca 1 gra1 grb1 2tioca 2 gra2 grb2 3tioca 3 gra3 grb3 4tioca 4 gra4 grb4
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 370 of 872 rej09b0325-0300 sample setup procedure for pwm mode figure 10.28 shows a sample procedure for setting up pwm mode. pwm mode 1. set bits tpsc2 to tpsc0 in tcr to select the counter clock source. if an external clock source is selected, set bits ckeg1 and ckeg0 in tcr to select the desired edge(s) of the external clock signal. pwm mode select counter clock 1 select counter clear source 2 set gra 3 set grb 4 select pwm mode 5 start counter 6 2. set bits cclr1 and cclr0 in tcr to select the counter clear source. 3. set the time at which the pwm waveform should go to 1 in gra. 4. set the time at which the pwm waveform should go to 0 in grb. 5. set the pwm bit in tmdr to select pwm mode. when pwm mode is selected, regardless of the tior contents, gra and grb become output compare registers specifying the times at which the pwm output goes to 1 and 0. the tioca pin automatically becomes the pwm output pin. the tiocb pin conforms to the settings of bits iob1 and iob0 in tior. if tiocb output is not desired, clear both iob1 and iob0 to 0. 6. set the str bit to 1 in tstr to start the timer counter. figure 10.28 setup procedure for pwm mode (example)
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 371 of 872 rej09b0325-0300 examples of pwm mode figure 10.29 shows examples of operation in pwm mode. in pwm mode tioca becomes an output pin. the output goes to 1 at compare match with gra, and to 0 at compare match with grb. in the examples shown, tcnt is cleared by compare match with gra or grb. synchronized operation and free-running counting are also possible. tcnt value counter cleared by compare match with gra time gra grb tioca a. counter cleared by gra tcnt value counter cleared by compare match with grb time grb gra tioca b. counter cleared by grb h'0000 h'0000 figure 10.29 pwm mode (example 1)
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 372 of 872 rej09b0325-0300 figure 10.30 shows examples of the output of pwm waveforms with duty cycles of 0% and 100%. if the counter is cleared by compare match with grb, and gra is set to a higher value than grb, the duty cycle is 0%. if the counter is cleared by compare match with gra, and grb is set to a higher value than gra, the duty cycle is 100%. tcnt value counter cleared by compare match with grb time grb gra tioca a. 0% duty cycle tcnt value counter cleared by compare match with gra time gra grb tioca b. 100% duty cycle write to gra write to gra write to grb write to grb h'0000 h'0000 figure 10.30 pwm mode (example 2)
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 373 of 872 rej09b0325-0300 10.4.5 reset-synchronized pwm mode in reset-synchronized pwm mode channels 3 and 4 are combined to produce three pairs of complementary pwm waveforms, all having one waveform transition point in common. when reset-synchronized pwm mode is selected tioca 3 , tiocb 3 , tioca 4 , tocxa 4 , tiocb 4 , and tocxb 4 automatically become pwm output pins, and tcnt3 functions as an up-counter. table 10.5 lists the pwm output pins. table 10.6 summarizes the register settings. table 10.5 output pins in reset-synchronized pwm mode channel output pin description 3tioca 3 pwm output 1 tiocb 3 pwm output 1' (complementary waveform to pwm output 1) 4tioca 4 pwm output 2 tocxa 4 pwm output 2' (complementary waveform to pwm output 2) tiocb 4 pwm output 3 tocxb 4 pwm output 3' (complementary waveform to pwm output 3) table 10.6 register settings in reset-synchronized pwm mode register setting tcnt3 initially set to h'0000 tcnt4 not used (operates independently) gra3 specifies the count period of tcnt3 grb3 specifies a transition point of pwm waveforms output from tioca 3 and tiocb 3 gra4 specifies a transition point of pwm waveforms output from tioca 4 and tocxa 4 grb4 specifies a transition point of pwm waveforms output from tiocb 4 and tocxb 4
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 374 of 872 rej09b0325-0300 sample setup procedure for reset-synchronized pwm mode figure 10.31 shows a sample procedure for setting up reset-synchronized pwm mode. reset-synchronized pwm mode 1. clear the str3 bit in tstr to 0 to halt tcnt3. reset-synchronized pwm mode must be set up while tcnt3 is halted. reset-synchronized pwm mode stop counter 1 select counter clock 2 select counter clear source 3 select reset-synchronized pwm mode 4 set tcnt 5 set general registers 6 2. set bits tpsc2 to tpsc0 in tcr to select the counter clock source for channel 3. if an external clock source is selected, select the external clock edge(s) with bits ckeg1 and ckeg0 in tcr. 3. set bits cclr1 and cclr0 in tcr3 to select gra3 compare match as the counter clear source. 4. set bits cmd1 and cmd0 in tfcr to select reset-synchronized pwm mode. tioca 3 , tiocb 3 , tioca 4 , tiocb 4 , tocxa 4 , and tocxb 4 automatically become pwm output pins. 5. preset tcnt3 to h'0000. tcnt4 need not be preset. start counter 7 6. gra3 is the waveform period register. set the waveform period value in gra3. set transition times of the pwm output waveforms in grb3, gra4, and grb4. set times within the compare match range of tcnt3. x gra3 (x: setting value) figure 10.31 setup procedure for reset-synchronized pwm mode (example)
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 375 of 872 rej09b0325-0300 example of reset-synchronized pwm mode figure 10.32 shows an example of operation in reset-synchronized pwm mode. tcnt3 operates as an up-counter in this mode. tcnt4 operates independently, detached from gra4 and grb4. when tcnt3 matches gra3, tcnt3 is cleared and resumes counting from h'0000. the pwm outputs toggle at compare match of tcnt3 with grb3, gra4, and grb4 respectively, and all toggle when the counter is cleared. tcnt3 value counter cleared at compare match with gra3 time gra3 grb3 gra4 grb4 h'0000 tioca 3 tiocb 3 tioca 4 tocxa 4 tiocb 4 tocxb 4 figure 10.32 operation in reset-synchronized pwm mode (example) (when ols3 = ols4 = 1) for the settings and operation when reset-synchronized pwm mode and buffer mode are both selected, see section 10.4.8, buffering.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 376 of 872 rej09b0325-0300 10.4.6 complementary pwm mode in complementary pwm mode channels 3 and 4 are combined to output three pairs of complementary, non-overlapping pwm waveforms. when complementary pwm mode is selected tioca 3 , tiocb 3 , tioca 4 , tocxa 4 , tiocb 4 , and tocxb 4 automatically become pwm output pins, and tcnt3 and tcnt4 function as up/down- counters. table 10.7 lists the pwm output pins. table 10.8 summarizes the register settings. table 10.7 output pins in complementary pwm mode channel output pin description 3tioca 3 pwm output 1 tiocb 3 pwm output 1' (non-overlapping complementary waveform to pwm output 1) 4tioca 4 pwm output 2 tocxa 4 pwm output 2' (non-overlapping complementary waveform to pwm output 2) tiocb 4 pwm output 3 tocxb 4 pwm output 3' (non-overlapping complementary waveform to pwm output 3) table 10.8 register settings in complementary pwm mode register setting tcnt3 initially specifies the non-overlap margin (difference to tcnt4) tcnt4 initially set to h'0000 gra3 specifies the upper limit value of tcnt3 minus 1 grb3 specifies a transition point of pwm waveforms output from tioca 3 and tiocb 3 gra4 specifies a transition point of pwm waveforms output from tioca 4 and tocxa 4 grb4 specifies a transition point of pwm waveforms output from tiocb 4 and tocxb 4
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 377 of 872 rej09b0325-0300 setup procedure for complementary pwm mode figure 10.33 shows a sample procedure for setting up complementary pwm mode. complementary pwm mode 1. clear bits str3 and str4 to 0 in tstr to halt the timer counters. complementary pwm mode must be set up while tcnt3 and tcnt4 are halted. complementary pwm mode stop counting 1 select counter clock 2 select complementary pwm mode 3 set tcnts 4 set general registers 5 start counters 6 2. set bits tpsc2 to tpsc0 in tcr to select the same counter clock source for channels 3 and 4. if an external clock source is selected, select the external clock edge(s) with bits ckeg1 and ckeg0 in tcr. do not select any counter clear source with bits cclr1 and cclr0 in tcr. 3. set bits cmd1 and cmd0 in tfcr to select complementary pwm mode. tioca 3 , tiocb 3 , tioca 4 , tiocb 4 , tocxa 4 , and tocxb 4 automatically become pwm output pins. 4. clear tcnt4 to h'0000. set the non-overlap margin in tcnt3. do not set tcnt3 and tcnt4 to the same value. 5. gra3 is the waveform period register. set the upper limit value of tcnt3 minus 1 in gra3. set transition times of the pwm output waveforms in grb3, gra4, and grb4. set times within the compare match range of tcnt3 and tcnt4. t x (x: initial setting of grb3, gra4, or grb4. t: initial setting of tcnt3) figure 10.33 setup procedure for complementary pwm mode (example)
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 378 of 872 rej09b0325-0300 clearing procedure for complementary pwm mode figure 10.34 shows the steps to clear complementary pwm mode. complementary pwm mode 1. clear the cmd1 bit of tfcr to 0 to set channels 3 and 4 to normal operating mode. normal operating mode clear complementary pwm mode 1 stop counter operation 2 2. after setting channels 3 and 4 to normal operating mode, wait at least one counter clock period, then clear bits str3 and str4 of tstr to 0 to stop counter operation of tcnt3 and tcnt4. figure 10.34 clearing procedure for complementary pwm mode
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 379 of 872 rej09b0325-0300 examples of complementary pwm mode figure 10.35 shows an example of operation in complementary pwm mode. tcnt3 and tcnt4 operate as up/down-counters, counting down from compare match between tcnt3 and gra3 and counting up from the point at which tcnt4 underflows. during each up-and-down counting cycle, pwm waveforms are generated by compare match with general registers grb3, gra4, and grb4. since tcnt3 is initially set to a higher value than tcnt4, compare match events occur in the sequence tcnt3, tcnt4, tcnt4, tcnt3. tcnt3 and tcnt4 values down-counting starts at compare match between tcnt3 and gra3 time gra3 grb3 gra4 grb4 h'0000 tioca 3 tiocb 3 tioca 4 tocxa 4 tiocb 4 tocxb 4 tcnt3 tcnt4 up-counting starts when tcnt4 underflows figure 10.35 operation in complementary pwm mode (example 1, ols3 = ols4 = 1)
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 380 of 872 rej09b0325-0300 figure 10.36 shows examples of waveforms with 0% and 100% duty cycles (in one phase) in complementary pwm mode. in this example the outputs change at compare match with grb3, so waveforms with duty cycles of 0% or 100% can be output by setting grb3 to a value larger than gra3. the duty cycle can be changed easily during operation by use of the buffer registers. for further information see section 10.4.8, buffering. tcnt3 and tcnt4 values time gra3 grb3 tioca 3 tiocb 3 0% duty cycle a. 0% duty cycle tcnt3 and tcnt4 values time gra3 grb3 tioca 3 tiocb 3 100% duty cycle b. 100% duty cycle h'0000 h'0000 figure 10.36 operation in complementary pwm mode (example 2, ols3 = ols4 = 1)
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 381 of 872 rej09b0325-0300 in complementary pwm mode, tcnt3 and tcnt4 overshoot and undershoot at the transitions between up-counting and down-counting. the setting conditions for the imfa bit in channel 3 and the ovf bit in channel 4 differ from the usual conditions. in buffered operation the buffer transfer conditions also differ. timing diagrams are shown in figures 10.37 and 10.38. tcnt3 gra3 imfa buffer transfer signal (br to gr) gr n ? ? figure 10.37 overshoot timing
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 382 of 872 rej09b0325-0300 tcnt4 ovf buffer transfer signal (br to gr) gr h'0001 h'0000 h'ffff h'0000 set to 1 flag not set no buffer transfer buffer transfer underflow overflow figure 10.38 undershoot timing in channel 3, imfa is set to 1 only during up-counting. in channel 4, ovf is set to 1 only when an underflow occurs. when buffering is selected, buffer register contents are transferred to the general register at compare match a3 during up-counting, and when tcnt4 underflows. general register settings in complementary pwm mode when setting up general registers for complementary pwm mode or changing their settings during operation, note the following points. ? initial settings do not set values from h'0000 to t ? 1 (where t is the initial value of tcnt3). after the counters start and the first compare match a3 event has occurred, however, settings in this range also become possible. ? changing settings use the buffer registers. correct waveform output may not be obtained if a general register is written to directly. ? cautions on changes of general register settings figure 10.39 shows six correct examples and one incorrect example.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 383 of 872 rej09b0325-0300 gra3 gr h'0000 br gr not allowed figure 10.39 changing a general register setting by buffer transfer (example 1) ? buffer transfer at transition from up-counting to down-counting if the general register value is in the range from gra3 ? t + 1 to gra3, do not transfer a buffer register value outside this range. conversely, if the general register value is outside this range, do not transfer a value within this range. see figure 10.40. gra3 + 1 gra3 gra3 ? ? figure 10.40 changing a general register setting by buffer transfer (caution 1) ? buffer transfer at transition from down-counting to up-counting if the general register value is in the range from h'0000 to t ? 1, do not transfer a buffer register value outside this range. conversely, when a general register value is outside this range, do not transfer a value within this range. see figure 10.41.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 384 of 872 rej09b0325-0300 t t ? figure 10.41 changing a general register setting by buffer transfer (caution 2) ? general register settings outside the counting range (h'0000 to gra3) waveforms with a duty cycle of 0% or 100% can be output by setting a general register to a value outside the counting range. when a buffer register is set to a value outside the counting range, then later restored to a value within the counting range, the counting direction (up or down) must be the same both times. see figure 10.42. 0% duty cycle 100% duty cycle write during down-counting write during up-counting gra3 gr h'0000 output pin output pin br gr figure 10.42 changing a general register setting by buffer transfer (example 2) settings can be made in this way by detecting gra3 compare match or tcnt4 underflow before writing to the buffer register. they can also be made by using gra3 compare match to activate the dmac.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 385 of 872 rej09b0325-0300 10.4.7 phase counting mode in phase counting mode the phase difference between two external clock inputs (at the tclka and tclkb pins) is detected, and tcnt2 counts up or down accordingly. in phase counting mode, the tclka and tclkb pins automatically function as external clock input pins and tcnt2 becomes an up/down-counter, regardless of the settings of bits tpsc2 to tpsc0, ckeg1, and ckeg0 in tcr2. settings of bits cclr1, cclr0 in tcr2, and settings in tior2, tier2, tsr2, gra2, and grb2 are valid. the input capture and output compare functions can be used, and interrupts can be generated. phase counting is available only in channel 2. sample setup procedure for phase counting mode figure 10.43 shows a sample procedure for setting up phase counting mode. phase counting mode select phase counting mode select flag setting condition start counter 1 2 3 phase counting mode 1. 2. 3. set the mdf bit in tmdr to 1 to select phase counting mode. select the flag setting condition with the fdir bit in tmdr. set the str2 bit to 1 in tstr to start the timer counter. figure 10.43 setup procedure for phase counting mode (example)
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 386 of 872 rej09b0325-0300 example of phase counting mode figure 10.44 shows an example of operations in phase counting mode. table 10.9 lists the up- counting and down-counting conditions for tcnt2. in phase counting mode both the rising and falling edges of tclka and tclkb are counted. the phase difference between tclka and tclkb must be at least 1.5 states, the phase overlap must also be at least 1.5 states, and the pulse width must be at least 2.5 states. see figure 10.45. tcnt2 value counting up counting down time tclkb tclka figure 10.44 operation in phase counting mode (example) table 10.9 up/down counting conditions counting direction up-counting down-counting tclkb figure 10.45 phase difference, overlap, and pulse width in phase counting mode
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 387 of 872 rej09b0325-0300 10.4.8 buffering buffering operates differently depending on whether a general register is an output compare register or an input capture register, with further differences in reset-synchronized pwm mode and complementary pwm mode. buffering is available only in channels 3 and 4. buffering operations under the conditions mentioned above are described next. ? general register used for output compare the buffer register value is transferred to the general register at compare match. see figure 10.46. compare match signal comparator tcnt gr br figure 10.46 compare match buffering ? general register used for input capture the tcnt value is transferred to the general register at input capture. the previous general register value is transferred to the buffer register. see figure 10.47. input capture signal br gr tcnt figure 10.47 input capture buffering ? complementary pwm mode the buffer register value is transferred to the general register when tcnt3 and tcnt4 change counting direction. this occurs at the following two times: ? when tcnt3 compare matches gra3 ? when tcnt4 underflows ? reset-synchronized pwm mode the buffer register value is transferred to the general register at compare match a3.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 388 of 872 rej09b0325-0300 sample buffering setup procedure figure 10.48 shows a sample buffering setup procedure. buffering select general register functions set buffer bits start counters buffered operation 11. 2. 3. 2 3 set tior to select the output compare or input capture function of the general registers. set bits bfa3, bfa4, bfb3, and bfb4 in tfcr to select buffering of the required general registers. set the str bits to 1 in tstr to start the timer counters. figure 10.48 buffering setup procedure (example) examples of buffering figure 10.49 shows an example in which gra is set to function as an output compare register buffered by bra, tcnt is set to operate as a periodic counter cleared by grb compare match, and tioca and tiocb are set to toggle at compare match a and b. because of the buffer setting, when tioca toggles at compare match a, the bra value is simultaneously transferred to gra. this operation is repeated each time compare match a occurs. figure 10.50 shows the transfer timing.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 389 of 872 rej09b0325-0300 grb h'0250 h'0200 h'0100 h'0000 bra gra tiocb tioca tcnt value counter cleared by compare match b time toggle output toggle output compare match a h'0200 h'0250 h'0100 h'0200 h'0100 h'0200 h'0200 figure 10.49 register buffering (example 1: buffering of output compare register) figure 10.50 compare match and buffer transfer timing (example) figure 10.51 shows an example in which gra is set to function as an input capture register buffered by bra, and tcnt is cleared by input capture b. the falling edge is selected as the input capture edge at tiocb. both edges are selected as input capture edges at tioca. because
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 390 of 872 rej09b0325-0300 of the buffer setting, when the tcnt value is captured into gra at input capture a, the previous gra value is simultaneously transferred to bra. figure 10.52 shows the transfer timing. h'0180 h'0160 h'0005 h'0000 tiocb tioca gra bra grb h'0005 h'0160 h'0005 h'0180 tcnt value counter cleared by input capture b time input capture a h'0160 figure 10.51 register buffering (example 2: buffering of input capture register) figure 10.52 input capture and buffer transfer timing (example)
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 391 of 872 rej09b0325-0300 figure 10.53 shows an example in which grb3 is buffered by brb3 in complementary pwm mode. buffering is used to set grb3 to a higher value than gra3, generating a pwm waveform with 0% duty cycle. the brb3 value is transferred to grb3 when tcnt3 matches gra3, and when tcnt4 underflows. tcnt3 and tcnt4 values time gra3 h'0999 h'0000 tcnt3 tcnt4 grb3 h'1fff brb3 grb3 tioca 3 tiocb 3 h'0999 h'0999 h'0999 h'1fff h'0999 h'1fff h'1fff h'0999 figure 10.53 register buffering (example 3: buffering in complementary pwm mode)
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 392 of 872 rej09b0325-0300 10.4.9 itu output timing the itu outputs from channels 3 and 4 can be disabled by bit settings in toer or by an external trigger, or inverted by bit settings in tocr. timing of enabling and disabling of itu output by toer in this example an itu output is disabled by clearing a master enable bit to 0 in toer. an arbitrary value can be output by appropriate settings of the data register (dr) and data direction register (ddr) of the corresponding input/output port. figure 10.54 illustrates the timing of the enabling and disabling of itu output by toer. figure 10.54 timing of disabling of itu output by writing to toer (example)
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 393 of 872 rej09b0325-0300 timing of disabling of itu output by external trigger if the xtgd bit is cleared to 0 in tocr in reset-synchronized pwm mode or complementary pwm mode, when an input capture a signal occurs in channel 1, the master enable bits are cleared to 0 in toer, disabling itu output. figure 10.55 shows the timing. figure 10.55 timing of disabling of itu output by external trigger (example)
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 394 of 872 rej09b0325-0300 timing of output inversion by tocr the output levels in reset-synchronized pwm mode and complementary pwm mode can be inverted by inverting the output level select bits (ols4 and ols3) in tocr. figure 10.56 shows the timing. figure 10.56 timing of inverting of itu output level by writing to tocr (example)
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 395 of 872 rej09b0325-0300 10.5 interrupts the itu has two types of interrupts: input capture/compare match interrupts, and overflow interrupts. 10.5.1 setting of status flags timing of setting of imfa and imfb at compare match imfa and imfb are set to 1 by a compare match signal generated when tcnt matches a general register (gr). the compare match signal is generated in the last state in which the values match (when tcnt is updated from the matching count to the next count). therefore, when tcnt matches a general register, the compare match signal is not generated until the next timer clock input. figure 10.57 shows the timing of the setting of imfa and imfb. tcnt gr imf imi tcnt input clock compare match signal nn + 1 n figure 10.57 timing of setting of imfa and imfb by compare match
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 396 of 872 rej09b0325-0300 timing of setting of imfa and imfb by input capture imfa and imfb are set to 1 by an input capture signal. the tcnt contents are simultaneously transferred to the corresponding general register. figure 10.58 shows the timing. input capture signal n n figure 10.58 timing of setting of imfa and imfb by input capture
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 397 of 872 rej09b0325-0300 timing of setting of overflow flag (ovf) ovf is set to 1 when tcnt overflows from h'ffff to h'0000 or underflows from h'0000 to h'ffff. figure 10.59 shows the timing. overflow signal h'ffff h'0000 figure 10.59 timing of setting of ovf
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 398 of 872 rej09b0325-0300 10.5.2 timing of clearing of status flags if the cpu reads a status flag while it is set to 1, then writes 0 in the status flag, the status flag is cleared. figure 10.60 shows the timing. figure 10.60 timing of clearing of status flags 10.5.3 interrupt sources and dma controller activation each itu channel can generate a compare match/input capture a interrupt, a compare match/input capture b interrupt, and an overflow interrupt. in total there are 15 interrupt sources, all independently vectored. an interrupt is requested when the interrupt request flag and interrupt enable bit are both set to 1. the priority order of the channels can be modified in interrupt priority registers a and b (ipra and iprb). for details see section 5, interrupt controller. compare match/input capture a interrupts in channels 0 to 3 can activate the dma controller (dmac). when the dmac is activated a cpu interrupt is not requested. table 10.10 lists the interrupt sources.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 399 of 872 rej09b0325-0300 table 10.10 itu interrupt sources channel interrupt source description dmac activatable priority * 0 imia0 compare match/input capture a0 yes high imib0 compare match/input capture b0 no ovi0 overflow 0 no 1 imia1 compare match/input capture a1 yes imib1 compare match/input capture b1 no ovi1 overflow 1 no 2 imia2 compare match/input capture a2 yes imib2 compare match/input capture b2 no ovi2 overflow 2 no 3 imia3 compare match/input capture a3 yes imib3 compare match/input capture b3 no ovi3 overflow 3 no 4 imia4 compare match/input capture a4 no imib4 compare match/input capture b4 no ovi4 overflow 4 no low note: * the priority immediately after a reset is indicated. inter-channel priorities can be changed by settings in ipra and iprb.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 400 of 872 rej09b0325-0300 10.6 usage notes this section describes contention and other matters requiring special attention during itu operations. contention between tcnt write and clear if a counter clear signal occurs in the t 3 state of a tcnt write cycle, clearing of the counter takes priority and the write is not performed. see figure 10.61. figure 10.61 contention between tcnt write and clear
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 401 of 872 rej09b0325-0300 contention between tcnt word write and increment if an increment pulse occurs in the t 3 state of a tcnt word write cycle, writing takes priority and tcnt is not incremented. see figure 10.62. figure 10.62 contention between tcnt word write and increment
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 402 of 872 rej09b0325-0300 contention between tcnt byte write and increment if an increment pulse occurs in the t 2 or t 3 state of a tcnt byte write cycle, writing takes priority and tcnt is not incremented. the tcnt byte that was not written retains its previous value. see figure 10.63, which shows an increment pulse occurring in the t 2 state of a byte write to tcnth. figure 10.63 contention between tcnt byte write and increment
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 403 of 872 rej09b0325-0300 contention between general register write and compare match if a compare match occurs in the t 3 state of a general register write cycle, writing takes priority and the compare match signal is inhibited. see figure 10.64. figure 10.64 contention between general register write and compare match
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 404 of 872 rej09b0325-0300 contention between tcnt write and overflow or underflow if an overflow occurs in the t 3 state of a tcnt write cycle, writing takes priority and the counter is not incremented. ovf is set to 1. the same holds for underflow. see figure 10.65. figure 10.65 contention between tcnt write and overflow
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 405 of 872 rej09b0325-0300 contention between general register read and input capture if an input capture signal occurs during the t 3 state of a general register read cycle, the value before input capture is read. see figure 10.66. figure 10.66 contention between general register read and input capture
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 406 of 872 rej09b0325-0300 contention between counter clearing by input capture and counter increment if an input capture signal and counter increment signal occur simultaneously, the counter is cleared according to the input capture signal. the counter is not incremented by the increment signal. the value before the counter is cleared is transferred to the general register. see figure 10.67. figure 10.67 contention between counter clearing by input capture and counter increment
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 407 of 872 rej09b0325-0300 contention between general register write and input capture if an input capture signal occurs in the t 3 state of a general register write cycle, input capture takes priority and the write to the general register is not performed. see figure 10.68. figure 10.68 contention between general register write and input capture note on waveform period setting when a counter is cleared by compare match, the counter is cleared in the last state at which the tcnt value matches the general register value, at the time when this value would normally be updated to the next count. the actual counter frequency is therefore given by the following formula: f =
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 408 of 872 rej09b0325-0300 contention between buffer register write and input capture if a buffer register is used for input capture buffering and an input capture signal occurs in the t 3 state of a write cycle, input capture takes priority and the write to the buffer register is not performed. see figure 10.69. figure 10.69 contention between buffer register write and input capture
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 409 of 872 rej09b0325-0300 note on synchronous preset when channels are synchronized, if a tcnt value is modified by byte write access, all 16 bits of all synchronized counters assume the same value as the counter that was addressed. example: when channels 2 and 3 are synchronized  byte write to channel 2 or byte write to channel 3 tcnt2 tcnt3 w y x z tcnt2 tcnt3 a a x x tcnt2 tcnt3 y y a a tcnt2 tcnt3 w y x z tcnt2 tcnt3 a a b b  word write to channel 2 or word write to channel 3 upper byte lower byte upper byte lower byte upper byte lower byte upper byte lower byte upper byte lower byte write a to upper byte of channel 2 write a to lower byte of channel 3 write ab word to channel 2 or 3 note on setup of reset-synchronized pwm mode and complementary pwm mode when setting bits cmd1 and cmd0 in tfcr, take the following precautions: ? write to bits cmd1 and cmd0 only when tcnt3 and tcnt4 are stopped. ? do not switch directly between reset-synchronized pwm mode and complementary pwm mode. first switch to normal mode (by clearing bit cmd1 to 0), then select reset-synchronized pwm mode or complementary pwm mode.
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 410 of 872 rej09b0325-0300 itu operating modes table 10.11 (a) itu operating modes (channel 0) operating mode tsnc tmdr tfcr tocr toer tior0 tcr0 register settings synchro- nization mdf fdir pwm comple- mentary pwm reset- synchro- nized pwm buffer- ing xtgd output level select master enable ioa iob clear select clock select synchronous preset pwm mode output compare a output compare b input capture a input capture b counter clearing by compare match/input capture a by compare match/input capture b syn- chronous clear legend: : setting available (valid). ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 411 of 872 rej09b0325-0300 table 10.11 (b) itu operating modes (channel 1) operating mode tsnc tmdr tfcr tocr toer tior1 tcr1 register settings synchro- nization mdf fdir pwm comple- mentary pwm reset- synchro- nized pwm buffer- ing xtgd output level select master enable ioa iob clear select clock select synchronous preset pwm mode output compare a output compare b input capture a input capture b counter clearing by compare match/input capture a by compare match/input capture b syn- chronous clear sync1 = 1 sync1 = 1 pwm1 = 1 pwm1 = 0 pwm1 = 0 pwm1 = 0 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 412 of 872 rej09b0325-0300 table 10.11 (c) itu operating modes (channel 2) operating mode tsnc tmdr tfcr tocr toer tior2 tcr2 register settings synchro- nization mdf fdir pwm comple- mentary pwm reset- synchro- nized pwm buffer- ing xtgd output level select master enable ioa iob clear select clock select synchronous preset pwm mode output compare a output compare b input capture a input capture b counter clearing by compare match/input capture a by compare match/input capture b syn- chronous clear legend: : setting available (valid). ? ? ioa2 = 0 other bits unrestricted ioa2 = 1 other bits unrestricted iob2 = 0 other bits unrestricted iob2 = 1 other bits unrestricted cclr1 = 0 cclr0 = 1 cclr1 = 1 cclr0 = 0 cclr1 = 1 cclr0 = 1 * phase counting mode mdf = 1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 413 of 872 rej09b0325-0300 table 10.11 (d) itu operating modes (channel 3) operating mode tsnc tmdr tfcr tocr toer tior3 tcr3 register settings synchro- nization mdf fdir pwm comple- mentary pwm reset- synchro- nized pwm buffer- ing xtgd output level select master enable ioa iob clear select clock select synchronous preset pwm mode output compare a output compare b input capture a input capture b counter clearing by compare match/input capture a complementary pwm mode reset-synchronized pwm mode buffering (bra) buffering (brb) by compare match/input capture b syn- chronous clear sync3 = 1 sync3 = 1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? ?? ?
section 10 16-bit integrated timer unit (itu) rev. 3.00 sep 27, 2006 page 414 of 872 rej09b0325-0300 table 10.11 (e) itu operating modes (channel 4) operating mode tsnc tmdr tfcr tocr toer tior4 tcr4 register settings synchro- nization mdf fdir pwm comple- mentary pwm reset- synchro- nized pwm buffer- ing xtgd output level select master enable ioa iob clear select clock select synchronous preset pwm mode output compare a output compare b input capture a input capture b counter clearing by compare match/input capture a complementary pwm mode reset-synchronized pwm mode buffering (bra) buffering (brb) by compare match/input capture b syn- chronous clear sync4 = 1 sync4 = 1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? ?? ?
section 11 programmable timing pattern controller rev. 3.00 sep 27, 2006 page 415 of 872 rej09b0325-0300 section 11 programmable timing pattern controller 11.1 overview the h8/3048b group has a built-in programmable timing pattern controller (tpc) that provides pulse outputs by using the 16-bit integrated timer unit (itu) as a time base. the tpc pulse outputs are divided into 4-bit groups (group 3 to group 0) that can operate simultaneously and independently. 11.1.1 features tpc features are listed below. ? 16-bit output data maximum 16-bit data can be output. tpc output can be enabled on a bit-by-bit basis. ? four output groups output trigger signals can be selected in 4-bit groups to provide up to four different 4-bit outputs. ? selectable output trigger signals output trigger signals can be selected for each group from the compare-match signals of four itu channels. ? non-overlap mode a non-overlap margin can be provided between pulse outputs. ? can operate together with the dma controller (dmac) the compare-match signals selected as trigger signals can activate the dmac for sequential output of data without cpu intervention.
section 11 programmable timing pattern controller rev. 3.00 sep 27, 2006 page 416 of 872 rej09b0325-0300 11.1.2 block diagram figure 11.1 shows a block diagram of the tpc. paddr ndera tpmr pbddr nderb tpcr internal data bus tp tp tp tp tp tp tp tp tp tp tp tp tp tp tp tp 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 control logic itu compare match signals pulse output pins, group 3 pbdr padr legend: tpmr: tpcr: nderb: ndera: pbddr: paddr: ndrb: ndra: pbdr: padr: pulse output pins, group 2 pulse output pins, group 1 pulse output pins, group 0 tpc output mode register tpc output control register next data enable register b next data enable register a port b data direction register port a data direction register next data register b next data register a port b data register port a data register ndrb ndra figure 11.1 tpc block diagram
section 11 programmable timing pattern controller rev. 3.00 sep 27, 2006 page 417 of 872 rej09b0325-0300 11.1.3 tpc pins table 11.1 summarizes the tpc output pins. table 11.1 tpc pins name symbol i/o function tpc output 0 tp 0 output group 0 pulse output tpc output 1 tp 1 output tpc output 2 tp 2 output tpc output 3 tp 3 output tpc output 4 tp 4 output group 1 pulse output tpc output 5 tp 5 output tpc output 6 tp 6 output tpc output 7 tp 7 output tpc output 8 tp 8 output group 2 pulse output tpc output 9 tp 9 output tpc output 10 tp 10 output tpc output 11 tp 11 output tpc output 12 tp 12 output group 3 pulse output tpc output 13 tp 13 output tpc output 14 tp 14 output tpc output 15 tp 15 output
section 11 programmable timing pattern controller rev. 3.00 sep 27, 2006 page 418 of 872 rej09b0325-0300 11.1.4 registers table 11.2 summarizes the tpc registers. table 11.2 tpc registers address * 1 name abbreviation r/w initial value h'ffd1 port a data direction register paddr w h'00 h'ffd3 port a data register padr r/(w) * 2 h'00 h'ffd4 port b data direction register pbddr w h'00 h'ffd6 port b data register pbdr r/(w) * 2 h'00 h'ffa0 tpc output mode register tpmr r/w h'f0 h'ffa1 tpc output control register tpcr r/w h'ff h'ffa2 next data enable register b nderb r/w h'00 h'ffa3 next data enable register a ndera r/w h'00 h'ffa5/ h'ffa7 * 3 next data register a ndra r/w h'00 h'ffa4 h'ffa6 * 3 next data register b ndrb r/w h'00 notes: 1. lower 16 bits of the address. 2. bits used for tpc output cannot be written. 3. the ndra address is h'ffa5 when the same output trigger is selected for tpc output groups 0 and 1 by settings in tpcr. when the output triggers are different, the ndra address is h'ffa7 for group 0 and h'ffa5 for group 1. similarly, the address of ndrb is h'ffa4 when the same output trigger is selected for tpc output groups 2 and 3 by settings in tpcr. when the output triggers are different, the ndrb address is h'ffa6 for group 2 and h'ffa4 for group 3.
section 11 programmable timing pattern controller rev. 3.00 sep 27, 2006 page 419 of 872 rej09b0325-0300 11.2 register descriptions 11.2.1 port a data direction register (paddr) paddr is an 8-bit write-only register that selects input or output for each pin in port a. bit initial value read/write 7 pa ddr 0 w port a data direction 7 to 0 these bits select input or output for port a pins 7 6 pa ddr 0 w 6 5 pa ddr 0 w 5 4 pa ddr 0 w 4 3 pa ddr 0 w 3 2 pa ddr 0 w 2 1 pa ddr 0 w 1 0 pa ddr 0 w 0 port a is multiplexed with pins tp 7 to tp 0 . bits corresponding to pins used for tpc output must be set to 1. for further information about paddr, see section 9.11, port a. 11.2.2 port a data register (padr) padr is an 8-bit readable/writable register that stores tpc output data for groups 0 and 1, when these tpc output groups are used. bit initial value read/write 0 pa 0 r/(w) 0 1 pa 0 r/(w) 1 2 pa 0 r/(w) 2 3 pa 0 r/(w) 3 4 pa 0 r/(w) 4 5 pa 0 r/(w) 5 6 pa 0 r/(w) 6 7 pa 0 r/(w) 7 port a data 7 to 0 these bits store output data for tpc output groups 0 and 1 ******** note: * bits selected for tpc output by ndera settings become read-only bits. for further information about padr, see section 9.11, port a.
section 11 programmable timing pattern controller rev. 3.00 sep 27, 2006 page 420 of 872 rej09b0325-0300 11.2.3 port b data direction register (pbddr) pbddr is an 8-bit write-only register that selects input or output for each pin in port b. bit initial value read/write 7 pb ddr 0 w port b data direction 7 to 0 these bits select input or output for port b pins 7 6 pb ddr 0 w 6 5 pb ddr 0 w 5 4 pb ddr 0 w 4 3 pb ddr 0 w 3 2 pb ddr 0 w 2 1 pb ddr 0 w 1 0 pb ddr 0 w 0 port b is multiplexed with pins tp 15 to tp 8 . bits corresponding to pins used for tpc output must be set to 1. for further information about pbddr, see section 9.12, port b. 11.2.4 port b data register (pbdr) pbdr is an 8-bit readable/writable register that stores tpc output data for groups 2 and 3, when these tpc output groups are used. bit initial value read/write 0 pb 0 r/(w) 0 1 pb 0 r/(w) 1 2 pb 0 r/(w) 2 3 pb 0 r/(w) 3 4 pb 0 r/(w) 4 5 pb 0 r/(w) 5 6 pb 0 r/(w) 6 7 pb 0 r/(w) 7 port b data 7 to 0 these bits store output data for tpc output groups 2 and 3 ******** note: * bits selected for tpc output by nderb settings become read-only bits. for further information about pbdr, see section 9.12, port b.
section 11 programmable timing pattern controller rev. 3.00 sep 27, 2006 page 421 of 872 rej09b0325-0300 11.2.5 next data register a (ndra) ndra is an 8-bit readable/writable register that stores the next output data for tpc output groups 1 and 0 (pins tp 7 to tp 0 ). during tpc output, when an itu compare match event specified in tpcr occurs, ndra contents are transferred to the corresponding bits in padr. the address of ndra differs depending on whether tpc output groups 0 and 1 have the same output trigger or different output triggers. ndra is initialized to h'00 by a reset and in hardware standby mode. it is not initialized in software standby mode. same trigger for tpc output groups 0 and 1 if tpc output groups 0 and 1 are triggered by the same compare match event, the ndra address is h'ffa5. the upper 4 bits belong to group 1 and the lower 4 bits to group 0. address h'ffa7 consists entirely of reserved bits that cannot be modified and are always read as 1. address h'ffa5 bit initial value read/write 7 ndr7 0 r/w 6 ndr6 0 r/w 5 ndr5 0 r/w 4 ndr4 0 r/w 3 ndr3 0 r/w 2 ndr2 0 r/w 1 ndr1 0 r/w 0 ndr0 0 r/w next data 3 to 0 these bits store the next output data for tpc output group 0 next data 7 to 4 these bits store the next output data for tpc output group 1 address h'ffa7 bit initial value read/write 0 ? 1 ? 1 ? 1 ? 2 ? 1 ? 3 ? 1 ? 4 ? 1 ? 5 ? 1 ? 6 ? 1 ? 7 ? 1 ? reserved bits
section 11 programmable timing pattern controller rev. 3.00 sep 27, 2006 page 422 of 872 rej09b0325-0300 different triggers for tpc output groups 0 and 1 if tpc output groups 0 and 1 are triggered by different compare match events, the address of the upper 4 bits of ndra (group 1) is h'ffa5 and the address of the lower 4 bits (group 0) is h'ffa7. bits 3 to 0 of address h'ffa5 and bits 7 to 4 of address h'ffa7 are reserved bits that cannot be modified and are always read as 1. address h'ffa5 bit initial value read/write 7 ndr7 0 r/w 6 ndr6 0 r/w 5 ndr5 0 r/w 4 ndr4 0 r/w 3 ? 1 ? 2 ? 1 ? 1 ? 1 ? 0 ? 1 ? reserved bits next data 7 to 4 these bits store the next output data for tpc output group 1 address h'ffa7 bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 ndr3 0 r/w 2 ndr2 0 r/w 1 ndr1 0 r/w 0 ndr0 0 r/w next data 3 to 0 these bits store the next output data for tpc output group 0 reserved bits
section 11 programmable timing pattern controller rev. 3.00 sep 27, 2006 page 423 of 872 rej09b0325-0300 11.2.6 next data register b (ndrb) ndrb is an 8-bit readable/writable register that stores the next output data for tpc output groups 3 and 2 (pins tp 15 to tp 8 ). during tpc output, when an itu compare match event specified in tpcr occurs, ndrb contents are transferred to the corresponding bits in pbdr. the address of ndrb differs depending on whether tpc output groups 2 and 3 have the same output trigger or different output triggers. ndrb is initialized to h'00 by a reset and in hardware standby mode. it is not initialized in software standby mode. same trigger for tpc output groups 2 and 3 if tpc output groups 2 and 3 are triggered by the same compare match event, the ndrb address is h'ffa4. the upper 4 bits belong to group 3 and the lower 4 bits to group 2. address h'ffa6 consists entirely of reserved bits that cannot be modified and are always read as 1. address h'ffa4 bit initial value read/write 7 ndr15 0 r/w 6 ndr14 0 r/w 5 ndr13 0 r/w 4 ndr12 0 r/w 3 ndr11 0 r/w 2 ndr10 0 r/w 1 ndr9 0 r/w 0 ndr8 0 r/w next data 11 to 8 these bits store the next output data for tpc output group 2 next data 15 to 12 these bits store the next output data for tpc output group 3 address h'ffa6 bit initial value read/write 0 ? 1 ? 1 ? 1 ? 2 ? 1 ? 3 ? 1 ? 4 ? 1 ? 5 ? 1 ? 6 ? 1 ? 7 ? 1 ? reserved bits
section 11 programmable timing pattern controller rev. 3.00 sep 27, 2006 page 424 of 872 rej09b0325-0300 different triggers for tpc output groups 2 and 3 if tpc output groups 2 and 3 are triggered by different compare match events, the address of the upper 4 bits of ndrb (group 3) is h'ffa4 and the address of the lower 4 bits (group 2) is h'ffa6. bits 3 to 0 of address h'ffa4 and bits 7 to 4 of address h'ffa6 are reserved bits that cannot be modified and are always read as 1. address h'ffa4 bit initial value read/write 7 ndr15 0 r/w 6 ndr14 0 r/w 5 ndr13 0 r/w 4 ndr12 0 r/w 3 ? 1 ? 2 ? 1 ? 1 ? 1 ? 0 ? 1 ? reserved bits next data 15 to 12 these bits store the next output data for tpc output group 3 address h'ffa6 bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 ndr11 0 r/w 2 ndr10 0 r/w 1 ndr9 0 r/w 0 ndr8 0 r/w next data 11 to 8 these bits store the next output data for tpc output group 2 reserved bits
section 11 programmable timing pattern controller rev. 3.00 sep 27, 2006 page 425 of 872 rej09b0325-0300 11.2.7 next data enable register a (ndera) ndera is an 8-bit readable/writable register that enables or disables tpc output groups 1 and 0 (tp 7 to tp 0 ) on a bit-by-bit basis. bit initial value read/write 0 nder0 0 r/w 1 nder1 0 r/w 2 nder2 0 r/w 3 nder3 0 r/w 4 nder4 0 r/w 5 nder5 0 r/w 6 nder6 0 r/w 7 nder7 0 r/w next data enable 7 to 0 these bits enable or disable tpc output groups 1 and 0 if a bit is enabled for tpc output by ndera, then when the itu compare match event selected in the tpc output control register (tpcr) occurs, the ndra value is automatically transferred to the corresponding padr bit, updating the output value. if tpc output is disabled, the bit value is not transferred from ndra to padr and the output value does not change. ndera is initialized to h'00 by a reset and in hardware standby mode. it is not initialized in software standby mode. bits 7 to 0?next data enable 7 to 0 (nder7 to nder0): these bits enable or disable tpc output groups 1 and 0 (tp 7 to tp 0 ) on a bit-by-bit basis. bits 7 to 0: nder7 to nder0 description 0 tpc outputs tp 7 to tp 0 are disabled (initial value) (ndr7 to ndr0 are not transferred to pa 7 to pa 0 ) 1 tpc outputs tp 7 to tp 0 are enabled (ndr7 to ndr0 are transferred to pa 7 to pa 0 )
section 11 programmable timing pattern controller rev. 3.00 sep 27, 2006 page 426 of 872 rej09b0325-0300 11.2.8 next data enable register b (nderb) nderb is an 8-bit readable/writable register that enables or disables tpc output groups 3 and 2 (tp 15 to tp 8 ) on a bit-by-bit basis. bit initial value read/write 0 nder8 0 r/w 1 nder9 0 r/w 2 nder10 0 r/w 3 nder11 0 r/w 4 nder12 0 r/w 5 nder13 0 r/w 6 nder14 0 r/w 7 nder15 0 r/w next data enable 15 to 8 these bits enable or disable tpc output groups 3 and 2 if a bit is enabled for tpc output by nderb, then when the itu compare match event selected in the tpc output control register (tpcr) occurs, the ndrb value is automatically transferred to the corresponding pbdr bit, updating the output value. if tpc output is disabled, the bit value is not transferred from ndrb to pbdr and the output value does not change. nderb is initialized to h'00 by a reset and in hardware standby mode. it is not initialized in software standby mode. bits 7 to 0?next data enable 15 to 8 (nder15 to nder8): these bits enable or disable tpc output groups 3 and 2 (tp 15 to tp 8 ) on a bit-by-bit basis. bits 7 to 0: nder15 to nder8 description 0 tpc outputs tp 15 to tp 8 are disabled (initial value) (ndr15 to ndr8 are not transferred to pb 7 to pb 0 ) 1 tpc outputs tp 15 to tp 8 are enabled (ndr15 to ndr8 are transferred to pb 7 to pb 0 )
section 11 programmable timing pattern controller rev. 3.00 sep 27, 2006 page 427 of 872 rej09b0325-0300 11.2.9 tpc output control register (tpcr) tpcr is an 8-bit readable/writable register that selects output trigger signals for tpc outputs on a group-by-group basis. bit initial value read/write 7 g3cms1 1 r/w 6 g3cms0 1 r/w 5 g2cms1 1 r/w 4 g2cms0 1 r/w 3 g1cms1 1 r/w 0 g0cms0 1 r/w 2 g1cms0 1 r/w 1 g0cms1 1 r/w group 3 compare match select 1 and 0 these bits select the compare match event that triggers tpc output group 3 (tp to tp ) group 2 compare match select 1 and 0 these bits select the compare match event that triggers tpc output group 2 (tp to tp ) group 1 compare match select 1 and 0 these bits select the compare match event that triggers tpc output group 1 (tp to tp ) group 0 compare match select 1 and 0 these bits select the compare match event that triggers tpc output group 0 (tp to tp ) 15 12 11 8 74 30 tpcr is initialized to h'ff by a reset and in hardware standby mode. it is not initialized in software standby mode. bits 7 and 6?group 3 compare match select 1 and 0 (g3cms1, g3cms0): these bits select the compare match event that triggers tpc output group 3 (tp 15 to tp 12 ). bit 7: g3cms1 bit 6: g3cms0 description 0 0 tpc output group 3 (tp 15 to tp 12 ) is triggered by compare match in itu channel 0 1 tpc output group 3 (tp 15 to tp 12 ) is triggered by compare match in itu channel 1 1 0 tpc output group 3 (tp 15 to tp 12 ) is triggered by compare match in itu channel 2 1 tpc output group 3 (tp 15 to tp 12 ) is triggered by compare match in itu channel 3 (initial value)
section 11 programmable timing pattern controller rev. 3.00 sep 27, 2006 page 428 of 872 rej09b0325-0300 bits 5 and 4?group 2 compare match select 1 and 0 (g2cms1, g2cms0): these bits select the compare match event that triggers tpc output group 2 (tp 11 to tp 8 ). bit 5: g2cms1 bit 4: g2cms0 description 0 0 tpc output group 2 (tp 11 to tp 8 ) is triggered by compare match in itu channel 0 1 tpc output group 2 (tp 11 to tp 8 ) is triggered by compare match in itu channel 1 1 0 tpc output group 2 (tp 11 to tp 8 ) is triggered by compare match in itu channel 2 1 tpc output group 2 (tp 11 to tp 8 ) is triggered by compare match in itu channel 3 (initial value) bits 3 and 2?group 1 compare match select 1 and 0 (g1cms1, g1cms0): these bits select the compare match event that triggers tpc output group 1 (tp 7 to tp 4 ). bit 3: g1cms1 bit 2: g1cms0 description 0 0 tpc output group 1 (tp 7 to tp 4 ) is triggered by compare match in itu channel 0 1 tpc output group 1 (tp 7 to tp 4 ) is triggered by compare match in itu channel 1 1 0 tpc output group 1 (tp 7 to tp 4 ) is triggered by compare match in itu channel 2 1 tpc output group 1 (tp 7 to tp 4 ) is triggered by compare match in itu channel 3 (initial value) bits 1 and 0?group 0 compare match select 1 and 0 (g0cms1, g0cms0): these bits select the compare match event that triggers tpc output group 0 (tp 3 to tp 0 ). bit 1: g0cms1 bit 0: g0cms0 description 0 0 tpc output group 0 (tp 3 to tp 0 ) is triggered by compare match in itu channel 0 1 tpc output group 0 (tp 3 to tp 0 ) is triggered by compare match in itu channel 1 1 0 tpc output group 0 (tp 3 to tp 0 ) is triggered by compare match in itu channel 2 1 tpc output group 0 (tp 3 to tp 0 ) is triggered by compare match in itu channel 3 (initial value)
section 11 programmable timing pattern controller rev. 3.00 sep 27, 2006 page 429 of 872 rej09b0325-0300 11.2.10 tpc output mode register (tpmr) tpmr is an 8-bit readable/writable register that selects normal or non-overlapping tpc output for each group. bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 g3nov 0 r/w 0 g0nov 0 r/w 2 g2nov 0 r/w 1 g1nov 0 r/w group 3 non-overlap selects non-overlapping tpc output for group 3 (tp to tp ) reserved bits group 2 non-overlap selects non-overlapping tpc output for group 2 (tp to tp ) group 1 non-overlap selects non-overlapping tpc output for group 1 (tp to tp ) group 0 non-overlap selects non-overlapping tpc output for group 0 (tp to tp ) 15 12 11 8 74 30 the output trigger period of a non-overlapping tpc output waveform is set in general register b (grb) in the itu channel selected for output triggering. the non-overlap margin is set in general register a (gra). the output values change at compare match a and b. for details see section 11.3.4, non-overlapping tpc output. tpmr is initialized to h'f0 by a reset and in hardware standby mode. it is not initialized in software standby mode. bits 7 to 4?reserved: read-only bits, always read as 1.
section 11 programmable timing pattern controller rev. 3.00 sep 27, 2006 page 430 of 872 rej09b0325-0300 bit 3?group 3 non-overlap (g3nov): selects normal or non-overlapping tpc output for group 3 (tp 15 to tp 12 ). bit 3: g3nov description 0 normal tpc output in group 3 (output values change at compare match a in the selected itu channel) (initial value) 1 non-overlapping tpc output in group 3 (independent 1 and 0 output at compare match a and b in the selected itu channel) bit 2?group 2 non-overlap (g2nov): selects normal or non-overlapping tpc output for group 2 (tp 11 to tp 8 ). bit 2: g2nov description 0 normal tpc output in group 2 (output values change at compare match a in the selected itu channel) (initial value) 1 non-overlapping tpc output in group 2 (independent 1 and 0 output at compare match a and b in the selected itu channel) bit 1?group 1 non-overlap (g1nov): selects normal or non-overlapping tpc output for group 1 (tp 7 to tp 4 ). bit 1: g1nov description 0 normal tpc output in group 1 (output values change at compare match a in the selected itu channel) (initial value) 1 non-overlapping tpc output in group 1 (independent 1 and 0 output at compare match a and b in the selected itu channel) bit 0?group 0 non-overlap (g0nov): selects normal or non-overlapping tpc output for group 0 (tp 3 to tp 0 ). bit 0: g0nov description 0 normal tpc output in group 0 (output values change at compare match a in the selected itu channel) (initial value) 1 non-overlapping tpc output in group 0 (independent 1 and 0 output at compare match a and b in the selected itu channel)
section 11 programmable timing pattern controller rev. 3.00 sep 27, 2006 page 431 of 872 rej09b0325-0300 11.3 operation 11.3.1 overview when corresponding bits in paddr or pbddr and ndera or nderb are set to 1, tpc output is enabled. the tpc output initially consists of the corresponding padr or pbdr contents. when a compare-match event selected in tpcr occurs, the corresponding ndra or ndrb bit contents are transferred to padr or pbdr to update the output values. figure 11.2 illustrates the tpc output operation. table 11.3 summarizes the tpc operating conditions. ddr nder qq tpc output pin dr ndr c qd qd internal data bus output trigger signal figure 11.2 tpc output operation table 11.3 tpc operating conditions nder ddr pin function 0 0 generic input port 1 generic output port 1 0 generic input port (but the dr bit is a read-only bit, and when compare match occurs, the ndr bit value is transferred to the dr bit) 1 tpc pulse output sequential output of up to 16-bit patterns is possible by writing new output data to ndra and ndrb before the next compare match. for information on non-overlapping operation, see section 11.3.4, non-overlapping tpc output.
section 11 programmable timing pattern controller rev. 3.00 sep 27, 2006 page 432 of 872 rej09b0325-0300 11.3.2 output timing if tpc output is enabled, ndra/ndrb contents are transferred to padr/pbdr and output when the selected compare match event occurs. figure 11.3 shows the timing of these operations for the case of normal output in groups 2 and 3, triggered by compare match a. tcnt gra compare match a signal ndrb pbdr tp to tp 815 n n n m m n + 1 n n figure 11.3 timing of transfer of next data register contents and output (example)
section 11 programmable timing pattern controller rev. 3.00 sep 27, 2006 page 433 of 872 rej09b0325-0300 11.3.3 normal tpc output sample setup procedure for normal tpc output figure 11.4 shows a sample procedure for setting up normal tpc output. normal tpc output set next tpc output data compare match? no yes set next tpc output data itu setup port and tpc setup itu setup 10 11 9 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. set tior to make gra an output compare register (with output inhibited). set the tpc output trigger period. select the counter clock source with bits tpsc2 to tpsc0 in tcr. select the counter clear source with bits cclr1 and cclr0. enable the imfa interrupt in tier. the dmac can also be set up to transfer data to the next data register. set the initial output values in the dr bits of the input/output port pins to be used for tpc output. set the ddr bits of the input/output port pins to be used for tpc output to 1. set the nder bits of the pins to be used for tpc output to 1. select the itu compare match event to be used as the tpc output trigger in tpcr. set the next tpc output values in the ndr bits. set the str bit to 1 in tstr to start the timer counter. at each imfa interrupt, set the next output values in the ndr bits. 1 2 3 4 5 6 7 8 select gr functions set gra value select counting operation select interrupt request start counter set initial output data select port output enable tpc output select tpc output trigger figure 11.4 setup procedure for normal tpc output (example)
section 11 programmable timing pattern controller rev. 3.00 sep 27, 2006 page 434 of 872 rej09b0325-0300 example of normal tpc output (example of five-phase pulse output) figure 11.5 shows an example in which the tpc is used for cyclic five-phase pulse output. gra h'0000 ndrb pbdr tp 15 tp 14 tp 13 tp 12 tp 11     time 80 tcnt tcnt value c0 40 60 20 30 10 18 08 88 80 c0 compare match the itu channel to be used as the output trigger channel is set up so that gra is an output compare register and the counter will be cleared by compare match a. the trigger period is set in gra. the imiea bit is set to 1 in tier to enable the compare match a interrupt. h'f8 is written in pbddr and nderb, and bits g3cms1, g3cms0, g2cms1, and g2cms0 are set in tpcr to select compare match in the itu channel set up in step 1 as the output trigger. output data h'80 is written in ndrb. the timer counter in this itu channel is started. when compare match a occurs, the ndrb contents are transferred to pbdr and output. the compare match/input capture a (imfa) interrupt service routine writes the next output data (h'c0) in ndrb. five-phase overlapping pulse output (one or two phases active at a time) can be obtained by writing h'40, h'60, h'20, h'30, h'10, h'18, h'08, h'88? at successive imfa interrupts. if the dmac is set for activation by this interrupt, pulse output can be obtained without loading the cpu. 00 80 c0 40 60 20 30 10 18 08 88 80 c0 40 figure 11.5 normal tpc output example (five-phase pulse output)
section 11 programmable timing pattern controller rev. 3.00 sep 27, 2006 page 435 of 872 rej09b0325-0300 11.3.4 non-overlapping tpc output sample setup procedure for non-overlapping tpc output figure 11.6 shows a sample procedure for setting up non-overlapping tpc output. non-overlapping tpc output set next tpc output data compare match a? no yes set next tpc output data start counter itu setup port and tpc setup itu setup set initial output data set up tpc output enable tpc transfer select tpc transfer trigger select non-overlapping groups 1 2 3 4 12 10 11 5 6 7 8 9 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. set tior to make gra and grb output compare registers (with output inhibited). set the tpc output trigger period in grb and the non-overlap margin in gra. select the counter clock source with bits tpsc2 to tpsc0 in tcr. select the counter clear source with bits cclr1 and cclr0. enable the imfa interrupt in tier. the dmac can also be set up to transfer data to the next data register. set the initial output values in the dr bits of the input/output port pins to be used for tpc output. set the ddr bits of the input/output port pins to be used for tpc output to 1. set the nder bits of the pins to be used for tpc output to 1. in tpcr, select the itu compare match event to be used as the tpc output trigger. in tpmr, select the groups that will operate in non-overlap mode. set the next tpc output values in the ndr bits. set the str bit to 1 in tstr to start the timer counter. at each imfa interrupt, write the next output value in the ndr bits. select gr functions set gr values select counting operation select interrupt requests figure 11.6 setup procedure for non-overlapping tpc output (example)
section 11 programmable timing pattern controller rev. 3.00 sep 27, 2006 page 436 of 872 rej09b0325-0300 example of non-overlapping tpc output (example of four-phase complementary non-overlapping output) figure 11.7 shows an example of the use of tpc output for four-phase complementary non- overlapping pulse output. grb h'0000 ndrb pbdr tp 15 tp 14 tp 13 tp 12 tp 11 tp 10 tp 9 tp 8 time 95 00 65 95 59 56 95 65 05 65 41 59 50 56 14 95 05 65 tcnt h'ff is written in pbddr and nderb, and bits g3cms1, g3cms0, g2cms1, and g2cms0 are set tcnt value non-overlap margin the output trigger itu channel is set up so that gra and grb are output compare registers and the counter will be cleared by compare match b. the tpc output trigger period is set in grb. the non- overlap margin is set in gra. the imiea bit is set to 1 in tier to enable imfa interrupts.     bits g3nov and g2nov are set to 1 in tpmr to select non-overlapping output. output data h'95 is written in ndrb. the timer counter in this itu channel is started. when compare match b occurs, outputs change from in tpcr to select compare match in the itu channel set up in step 1 as the output trigger. 1 to 0. when compare match a occurs, outputs change from 0 to 1 (the change from 0 to 1 is delayed by the value of gra). the imfa interrupt service routine writes the next output data (h'65) in ndrb. four-phase complementary non-overlapping pulse output can be obtained by writing h'59, h'56, h'95 ? at successive imfa interrupts. if the dmac is set for activation by this interrupt, pulse output can be obtained without loading the cpu. gra figure 11.7 non-overlapping tpc output example (four-phase complementary non-overlapping pulse output)
section 11 programmable timing pattern controller rev. 3.00 sep 27, 2006 page 437 of 872 rej09b0325-0300 11.3.5 tpc output triggering by input capture tpc output can be triggered by itu input capture as well as by compare match. if gra and grb functions as an input capture register in the itu channel selected in tpcr, tpc output will be triggered by the input capture signal. figure 11.8 shows the timing. figure 11.8 tpc output triggering by input capture (example)
section 11 programmable timing pattern controller rev. 3.00 sep 27, 2006 page 438 of 872 rej09b0325-0300 11.4 usage notes 11.4.1 operation of tpc output pins tp 0 to tp 15 are multiplexed with itu, dmac, address bus, and other pin functions. when itu, dmac, or address output is enabled, the corresponding pins cannot be used for tpc output. the data transfer from ndr bits to dr bits takes place, however, regardless of the usage of the pin. pin functions should be changed only under conditions in which the output trigger event will not occur. 11.4.2 note on non-overlapping output during non-overlapping operation, the transfer of ndr bit values to dr bits takes place as follows. 1. ndr bits are always transferred to dr bits at compare match a. 2. at compare match b, ndr bits are transferred only if their value is 0. bits are not transferred if their value is 1. figure 11.9 illustrates the non-overlapping tpc output operation. ddr nder qq tpc output pin dr ndr c qd qd compare match a compare match b internal data bus figure 11.9 non-overlapping tpc output
section 11 programmable timing pattern controller rev. 3.00 sep 27, 2006 page 439 of 872 rej09b0325-0300 therefore, 0 data can be transferred ahead of 1 data by making compare match b occur before compare match a. ndr contents should not be altered during the interval from compare match b to compare match a (the non-overlap margin). this can be accomplished by having the imfa interrupt service routine write the next data in ndr, or by having the imfa interrupt activate the dmac. the next data must be written before the next compare match b occurs. figure 11.10 shows the timing relationships. compare match a compare match b ndr write ndr ndr write dr 0/1 output 0/1 output 0 output 0 output do not write to ndr in this interval do not write to ndr in this interval write to ndr in this interval write to ndr in this interval figure 11.10 non-overlapping operation and ndr write timing
section 11 programmable timing pattern controller rev. 3.00 sep 27, 2006 page 440 of 872 rej09b0325-0300
section 12 watchdog timer rev. 3.00 sep 27, 2006 page 441 of 872 rej09b0325-0300 section 12 watchdog timer 12.1 overview the h8/3048b group has an on-chip watchdog timer (wdt). the wdt has two selectable functions: it can operate as a watchdog timer to supervise system operation, or it can operate as an interval timer. as a watchdog timer, it generates a reset signal for the chip if a system crash allows the timer counter (tcnt) to overflow before being rewritten. in interval timer operation, an interval timer interrupt is requested at each tcnt overflow. 12.1.1 features wdt features are listed below. ? selection of eight counter clock sources /2, /32, /64, /128, /256, /512, /2048, or /4096 ? interval timer option ? timer counter overflow generates a reset signal or interrupt. the reset signal is generated in watchdog timer operation. an interval timer interrupt is generated in interval timer operation. ? the entire chip can be reset internally by a reset signal output from the watchdog timer. the reset signal generated by timer counter overflow during watchdog timer operation resets the entire chip internally. in an h8/3048f-one (single power supply with flash memory), the reso pin acts as the fwe pin; no external reset signal can be output.
section 12 watchdog timer rev. 3.00 sep 27, 2006 page 442 of 872 rej09b0325-0300 12.1.2 block diagram figure 12.1 shows a block diagram of the wdt. /2 /32 /64 /128 /256 /512 /2048 /4096 tcnt tcsr rstcsr reset control interrupt signal reset (internal, external) (interval timer) interrupt control overflow clock clock selector reso * read/ write control internal data bus internal clock sources legend: tcnt: tcsr: rstcsr: note: * open-drain output pin timer counter timer control/status register reset control/status register figure 12.1 wdt block diagram 12.1.3 pin configuration output pins used by the wdt * 1 are shown in table 12.11. table 12.1 wdt pins pin name abbreviation i/o function reset output reso output * 2 external output of watchdog timer reset signal notes: 1. not provided in on-chip flash memory versions. 2. open-drain output pin
section 12 watchdog timer rev. 3.00 sep 27, 2006 page 443 of 872 rej09b0325-0300 12.1.4 register configuration table 12.2 summarizes the wdt registers. table 12.2 wdt registers address * 1 write * 2 read name abbre- viation r/w initial value h'ffa8 h'ffa8 timer control/status register tcsr r/(w) * 3 h'18 h'ffa9 timer counter tcnt r/w h'00 h'ffaa h'ffab reset control/status register rstcsr r/(w) * 3 h'3f notes: 1. lower 16 bits of the address. 2. write word data starting at this address. 3. only 0 can be written in bit 7, to clear the flag. 12.2 register descriptions 12.2.1 timer counter (tcnt) tcnt is an 8-bit readable and writable * up-counter. bit initial value read/write 7 0 r/w 6 0 r/w 5 0 r/w 4 0 r/w 3 0 r/w 0 0 r/w 2 0 r/w 1 0 r/w when the tme bit is set to 1 in tcsr, tcnt starts counting pulses generated from an internal clock source selected by bits cks2 to cks0 in tcsr. when the count overflows (changes from h'ff to h'00), the ovf bit is set to 1 in tcsr. tcnt is initialized to h'00 by a reset and when the tme bit is cleared to 0. note: * tcnt is write-protected by a password. for details see section 12.2.4, notes on register rewriting.
section 12 watchdog timer rev. 3.00 sep 27, 2006 page 444 of 872 rej09b0325-0300 12.2.2 timer control/status register (tcsr) tcsr is an 8-bit readable and writable * register. its functions include selecting the timer mode and clock source. note: * tcsr differs from other registers in being more difficult to write. for details see section 12.2.4, notes on register rewriting. bit initial value read/write note: * only 0 can be written, to clear the flag. 7 ovf 0 r/(w) 6 wt/ it 0 r/w 5 tme 0 r/w 4 ? 1 ? 3 ? 1 ? 0 cks0 0 r/w 2 cks2 0 r/w 1 cks1 0 r/w overflow flag status flag indicating overflow clock select these bits select the tcnt clock source timer mode select selects the mode timer enable selects whether tcnt runs or halts reserved bits * bits 7 to 5 are initialized to 0 by a reset and in standby mode. bits 2 to 0 are initialized to 0 by a reset. in software standby mode bits 2 to 0 are not initialized, but retain their previous values. bit 7?overflow flag (ovf): this status flag indicates that the timer counter has overflowed from h'ff to h'00. bit 7: ovf description 0 [clearing condition] cleared by reading ovf when ovf = 1, then writing 0 in ovf (initial value) 1 [setting condition] set when tcnt changes from h'ff to h'00
section 12 watchdog timer rev. 3.00 sep 27, 2006 page 445 of 872 rej09b0325-0300 bit 6?timer mode select (wt/ it it it it ): selects whether to use the wdt as a watchdog timer or interval timer. if used as an interval timer, the wdt generates an interval timer interrupt request when tcnt overflows. if used as a watchdog timer, the wdt generates a reset signal when tcnt overflows. bit 6: wt/ it it it it description 0 interval timer: requests interval timer interrupts (initial value) 1 watchdog timer: generates a reset signal bit 5?timer enable (tme): selects whether tcnt runs or is halted. when wt/ it = 1, clear the syscr software standby bit (ssby) to 0, then set the tme to 1. when ssby is set to 1, clear tme to 0. bit 5: tme description 0 tcnt is initialized to h'00 and halted (initial value) 1 tcnt is counting and cpu interrupt requests are enabled bits 4 and 3?reserved: read-only bits, always read as 1. bits 2 to 0?clock select 2 to 0 (cks2 to cks0): these bits select one of eight internal clock sources, obtained by prescaling the system clock ( ), for input to tcnt. bit 2: cks2 bit 1: cks1 bit 0: cks0 description 000 /2 (initial value) 1 /32 10 /64 1 /128 100 /256 1 /512 10 /2048 1 /4096
section 12 watchdog timer rev. 3.00 sep 27, 2006 page 446 of 872 rej09b0325-0300 12.2.3 reset control/status register (rstcsr) rstcsr is an 8-bit readable and writable register that indicates when a reset signal has been generated by watchdog timer overflow, and controls external output of the reset signal. bit initial value read/write notes: the method for writing to rstcsr is different from that for general registers to prevent inadvertent overwriting. for details see section 12.2.4, notes on register rewriting. * only 0 can be written in bit 7, to clear the flag. 7 wrst 0 r/(w) 6 rstoe 0 r/w 5 ? 1 ? 4 ? 1 ? 3 ? 1 ? 0 ? 1 ? 2 ? 1 ? 1 ? 1 ? * watchdog timer reset indicates that a reset signal has been generated reserved bits reset output enable enables or disables external output of the reset signal bits 7 and 6 are initialized by input of a reset signal at the res pin. they are not initialized by reset signals generated by watchdog timer overflow. bit 7?watchdog timer reset (wrst): during watchdog timer operation, this bit indicates that tcnt has overflowed and generated a reset signal. this reset signal resets the entire chip internally. if bit rstoe is set to 1, this reset signal is also output (low) at the reso pin to initialize external system devices. note that there is no reso pin in the versions with on-chip flash memory. bit 7 wrst description 0 [clearing conditions] ? reset signal at res pin. ? read wrst when wrst = 1, then write 0 in wrst. (initial value) 1 [setting condition] set when tcnt overflow generates a reset signal during watchdog timer operation
section 12 watchdog timer rev. 3.00 sep 27, 2006 page 447 of 872 rej09b0325-0300 bit 6?reset output enable (rstoe): enables or disables external output at the reso pin of the reset signal generated if tcnt overflows during watchdog timer operation. note that there is no reso pin in the versions with on-chip flash memory. bit 6 rstoe description 0 reset signal is not output externally (initial value) 1 reset signal is output externally bits 5 to 0?reserved: these bits cannot be modified and are always read as 1. 12.2.4 notes on register rewriting the watchdog timer?s tcnt, tcsr, and rstcsr registers differ from other registers in being more difficult to write. the procedures for writing and reading these registers are given below. writing to tcnt and tcsr these registers must be written by a word transfer instruction. they cannot be written by byte instructions. figure 12.2 shows the format of data written to tcnt and tcsr. tcnt and tcsr both have the same write address. the write data must be contained in the lower byte of the written word. the upper byte must contain h'5a (password for tcnt) or h'a5 (password for tcsr). this transfers the write data from the lower byte to tcnt or tcsr. 15 8 7 0 h'5a write data address h'ffa8 * 15 8 7 0 h'a5 write data address h'ffa8 * tcnt write tcsr write note: * lower 16 bits of the address. figure 12.2 format of data written to tcnt and tcsr
section 12 watchdog timer rev. 3.00 sep 27, 2006 page 448 of 872 rej09b0325-0300 writing to rstcsr rstcsr must be written by a word transfer instruction. it cannot be written by byte transfer instructions. figure 12.3 shows the format of data written to rstcsr. to write 0 in the wrst bit, the write data must have h'a5 in the upper byte and h'00 in the lower byte. the h'00 in the lower byte clears the wrst bit in rstcsr to 0. to write to the rstoe bit, the upper byte must contain h'5a and the lower byte must contain the write data. writing this word transfers a write data value into the rstoe bit. 15 8 7 0 h'a5 h'00 address h'ffaa * 15 8 7 0 h'5a write data address h'ffaa * writing 0 in wrst bit writing to rstoe bit note: * lower 16 bits of the address. figure 12.3 format of data written to rstcsr reading tcnt, tcsr, and rstcsr these registers are read like other registers. byte access instructions can be used. the read addresses are h'ffa8 for tcsr, h'ffa9 for tcnt, and h'ffab for rstcsr, as listed in table 12.3. table 12.3 read addresses of tcnt, tcsr, and rstcsr address * register h'ffa8 tcsr h'ffa9 tcnt h'ffab rstcsr note: * lower 16 bits of the address.
section 12 watchdog timer rev. 3.00 sep 27, 2006 page 449 of 872 rej09b0325-0300 12.3 operation operations when the wdt is used as a watchdog timer and as an interval timer are described below. 12.3.1 watchdog timer operation figure 12.4 illustrates watchdog timer operation. to use the wdt as a watchdog timer, set the wt/ it and tme bits to 1 in tcsr. software must prevent tcnt overflow by rewriting the tcnt value (normally by writing h'00) before overflow occurs. if tcnt fails to be rewritten and overflows due to a system crash etc., the chip is internally reset for a duration of 518 states. the watchdog reset signal can be externally output from the reso pin to reset external system devices. the reset signal is output externally for 132 states. external output can be enabled or disabled by the rstoe bit in rstcsr. note that there is no reso pin in the versions with on- chip flash memory. a watchdog reset has the same vector as a reset generated by input at the res pin. software can distinguish a res reset from a watchdog reset by checking the wrst bit in rstcsr. if a res reset and a watchdog reset occur simultaneously, the res reset takes priority. h'ff h'00 wdt overflow start h'00 written in tcnt reset tme set to 1 h'00 written in tcnt internal reset signal 518 states reso 132 states tcnt count value ovf = 1 figure 12.4 watchdog timer operation
section 12 watchdog timer rev. 3.00 sep 27, 2006 page 450 of 872 rej09b0325-0300 12.3.2 interval timer operation figure 12.5 illustrates interval timer operation. to use the wdt as an interval timer, clear bit wt/ it to 0 and set bit tme to 1 in tcsr. an interval timer interrupt request is generated at each tcnt overflow. this function can be used to generate interval timer interrupts at regular intervals. tcnt count value time t interval timer interrupt interval timer interrupt interval timer interrupt interval timer interrupt wt/ = 0 tme = 1 it h'ff h'00 figure 12.5 interval timer operation 12.3.3 timing of setting of overflow flag (ovf) figure 12.6 shows the timing of setting of the ovf flag in tcsr. the ovf flag is set to 1 when tcnt overflows. at the same time, a reset signal is generated in watchdog timer operation, or an interval timer interrupt is generated in interval timer operation. tcnt overflow signal ovf h'ff h'00 figure 12.6 timing of setting of ovf
section 12 watchdog timer rev. 3.00 sep 27, 2006 page 451 of 872 rej09b0325-0300 12.3.4 timing of setting of watchdog timer reset bit (wrst) the wrst bit in rstcsr is valid when bits wt/ it and tme are both set to 1 in tcsr. figure 12.7 shows the timing of setting of wrst and the internal reset timing. the wrst bit is set to 1 when tcnt overflows and ovf is set to 1. at the same time an internal reset signal is generated for the entire chip. this internal reset signal clears ovf to 0, but the wrst bit remains set to 1. the reset routine must therefore clear the wrst bit. tcnt overflow signal ovf wrst h'ff h'00 wdt internal reset figure 12.7 timing of setting of wrst bit and internal reset
section 12 watchdog timer rev. 3.00 sep 27, 2006 page 452 of 872 rej09b0325-0300 12.4 interrupts during interval timer operation, an overflow generates an interval timer interrupt (wovi). the interval timer interrupt is requested whenever the ovf bit is set to 1 in tcsr. 12.5 usage notes contention between tcnt write and increment if a timer counter clock pulse is generated during the t 3 state of a write cycle to tcnt, the write takes priority and the timer count is not incremented. see figure 12.8. tcnt tcnt nm counter write data t 3 t 2 t 1 write cycle: cpu writes to tcnt internal write signal tcnt input clock figure 12.8 contention between tcnt write and increment changing cks2 to cks0 values halt tcnt by clearing the tme bit to 0 in tcsr before changing the values of bits cks2 to cks0.
section 12 watchdog timer rev. 3.00 sep 27, 2006 page 453 of 872 rej09b0325-0300 12.6 notes this chip incorporates an wdt. the timer counter value of the on-chip wdt is not rewritten, even if a system crash occurs. if an overflow occurs, a reset signal is generated and the chip is reset. however, if the following three events occur due to a cpu overrun, for example, the above operations cannot be guaranteed since the wdt and the cpu are incorporated in the same chip. ? when the internal i/o registers related to the on-chip wdt are rewritten. ? when software standby mode is incorrectly entered. ? when the break mode is incorrectly entered. in addition, as stated in the nmi above, if an abnormal level is input into the power supply pins or the system control pins, correct operations cannot be guaranteed. except the above cases, the on-chip wdt functions as a device that supports recovery from a system crash. accordingly, when a fail-safe function is required in your system, an additional circuit may be required as necessary.
section 12 watchdog timer rev. 3.00 sep 27, 2006 page 454 of 872 rej09b0325-0300
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 455 of 872 rej09b0325-0300 section 13 serial communication interface 13.1 overview the h8/3048b group has a serial communication interface (sci) with two independent channels. the two channels are functionally identical. the sci can communicate in asynchronous or synchronous mode. it also has a multiprocessor communication function for serial communication among two or more processors. when the sci is not used, it can be halted to conserve power. each sci channel can be halted independently. for details see section 20.6, module standby function. channel 0 (sci0) also has a smart card interface function conforming to the iso/iec7816-3 (identification card) standard. this function supports serial communication with a smart card. for details, see section 14, smart card interface. 13.1.1 features sci features are listed below. ? selection of asynchronous or synchronous mode for serial communication ? asynchronous mode serial data communication is synchronized one character at a time. the sci can communicate with a universal asynchronous receiver/transmitter (uart), asynchronous communication interface adapter (acia), or other chip that employs standard asynchronous serial communication. it can also communicate with two or more other processors using the multiprocessor communication function. there are twelve selectable serial data communication formats. ? data length: 7 or 8 bits ? stop bit length: 1 or 2 bits ? parity bit: even, odd, or none ? multiprocessor bit: 1 or 0 ? receive error detection: parity, overrun, and framing errors ? break detection: by reading the rxd level directly when a framing error occurs
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 456 of 872 rej09b0325-0300 ? synchronous mode serial data communication is synchronized with a clock signal. the sci can communicate with other chips having a synchronous communication function. there is one serial data communication format. ? data length: 8 bits ? receive error detection: overrun errors ? full duplex communication the transmitting and receiving sections are independent, so the sci can transmit and receive simultaneously. the transmitting and receiving sections are both double-buffered, so serial data can be transmitted and received continuously. ? built-in baud rate generator with selectable bit rates ? selectable transmit/receive clock sources: internal clock from baud rate generator, or external clock from the sck pin. ? four types of interrupts transmit-data-empty, transmit-end, receive-data-full, and receive-error interrupts are requested independently. the transmit-data-empty and receive-data-full interrupts from sci0 can activate the dma controller (dmac) to transfer data.
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 457 of 872 rej09b0325-0300 13.1.2 block diagram figure 13.1 shows a block diagram of the sci. rxd txd sck rdr rsr tdr tsr ssr scr smr brr module data bus bus interface internal data bus transmit/ receive control baud rate generator /4 /16 /64 clock parity generate parity check tei txi rxi eri legend: external clock rsr: rdr: tsr: tdr: smr: scr: ssr: brr: receive shift register receive data register transmit shift register transmit data register serial mode register serial control register serial status register bit rate register figure 13.1 sci block diagram
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 458 of 872 rej09b0325-0300 13.1.3 input/output pins the sci has serial pins for each channel as listed in table 13.1. table 13.1 sci pins channel name abbreviation i/o function 0 serial clock pin sck 0 input/output sci 0 clock input/output receive data pin rxd 0 input sci 0 receive data input transmit data pin txd 0 output sci 0 transmit data output 1 serial clock pin sck 1 input/output sci 1 clock input/output receive data pin rxd 1 input sci 1 receive data input transmit data pin txd 1 output sci 1 transmit data output 13.1.4 register configuration the sci has internal registers as listed in table 13.2. these registers select asynchronous or synchronous mode, specify the data format and bit rate, and control the transmitter and receiver sections. table 13.2 registers channel address * 1 name abbreviation r/w initial value 0 h'ffb0 serial mode register smr r/w h'00 h'ffb1 bit rate register brr r/w h'ff h'ffb2 serial control register scr r/w h'00 h'ffb3 transmit data register tdr r/w h'ff h'ffb4 serial status register ssr r/(w) * 2 h'84 h'ffb5 receive data register rdr r h'00 1 h'ffb8 serial mode register smr r/w h'00 h'ffb9 bit rate register brr r/w h'ff h'ffba serial control register scr r/w h'00 h'ffbb transmit data register tdr r/w h'ff h'ffbc serial status register ssr r/(w) * 2 h'84 h'ffbd receive data register rdr r h'00 notes: 1. lower 16 bits of the address. 2. only 0 can be written, to clear flags.
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 459 of 872 rej09b0325-0300 13.2 register descriptions 13.2.1 receive shift register (rsr) rsr is the register that receives serial data. bit read/write 7 ? 6 ? 5 ? 4 ? 3 ? 0 ? 2 ? 1 ? the sci loads serial data input at the rxd pin into rsr in the order received, lsb (bit 0) first, thereby converting the data to parallel data. when 1 byte has been received, it is automatically transferred to rdr. the cpu cannot read or write rsr directly. 13.2.2 receive data register (rdr) rdr is the register that stores received serial data. bit initial value read/write 7 0 r 6 0 r 5 0 r 4 0 r 3 0 r 0 0 r 2 0 r 1 0 r when the sci finishes receiving 1 byte of serial data, it transfers the received data from rsr into rdr for storage. rsr is then ready to receive the next data. this double buffering allows data to be received continuously. rdr is a read-only register. its contents cannot be modified by the cpu. rdr is initialized to h'00 by a reset and in standby mode.
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 460 of 872 rej09b0325-0300 13.2.3 transmit shift register (tsr) tsr is the register that transmits serial data. bit read/write 7 ? 6 ? 5 ? 4 ? 3 ? 0 ? 2 ? 1 ? the sci loads transmit data from tdr into tsr, then transmits the data serially from the txd pin, lsb (bit 0) first. after transmitting one data byte, the sci automatically loads the next transmit data from tdr into tsr and starts transmitting it. if the tdre flag is set to 1 in ssr, however, the sci does not load the tdr contents into tsr. the cpu cannot read or write tsr directly. 13.2.4 transmit data register (tdr) tdr is an 8-bit register that stores data for serial transmission. bit initial value read/write 7 1 r/w 6 1 r/w 5 1 r/w 4 1 r/w 3 1 r/w 0 1 r/w 2 1 r/w 1 1 r/w when the sci detects that tsr is empty, it moves transmit data written in tdr from tdr into tsr and starts serial transmission. continuous serial transmission is possible by writing the next transmit data in tdr during serial transmission from tsr. the cpu can always read and write tdr. tdr is initialized to h'ff by a reset and in standby mode.
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 461 of 872 rej09b0325-0300 13.2.5 serial mode register (smr) smr is an 8-bit register that specifies the sci serial communication format and selects the clock source for the baud rate generator. bit initial value read/write 7 c/a 0 r/w 6 chr 0 r/w 5 pe 0 r/w 4 o/e 0 r/w 3 stop 0 r/w 0 cks0 0 r/w 2 mp 0 r/w 1 cks1 0 r/w communication mode selects asynchronous or synchronous mode clock select 1/0 these bits select the baud rate generator?s clock source character length selects character length in asynchronous mode parity enable selects whether a parity bit is added parity mode selects even or odd parity stop bit length selects the stop bit length multiprocessor mode selects the multiprocessor function the cpu can always read and write smr. smr is initialized to h'00 by a reset and in standby mode. bit 7?communication mode (c/ a a a a ): selects whether the sci operates in asynchronous or synchronous mode. bit 7: c/ a a a a description 0 asynchronous mode (initial value) 1 synchronous mode
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 462 of 872 rej09b0325-0300 bit 6?character length (chr): selects 7-bit or 8-bit data length in asynchronous mode. in synchronous mode the data length is 8 bits regardless of the chr setting. bit 6: chr description 0 8-bit data (initial value) 1 7-bit data * note: * when 7-bit data is selected, the msb (bit 7) in tdr is not transmitted. bit 5?parity enable (pe): in asynchronous mode, this bit enables or disables the addition of a parity bit to transmit data, and the checking of the parity bit in receive data. in synchronous mode the parity bit is neither added nor checked, regardless of the pe setting. bit 5: pe description 0 parity bit not added or checked (initial value) 1 parity bit added and checked * note: * when pe is set to 1, an even or odd parity bit is added to transmit data according to the even or odd parity mode selected by the o/ e bit, and the parity bit in receive data is checked to see that it matches the even or odd mode selected by the o/ e bit. bit 4?parity mode (o/ e e e e ): selects even or odd parity. the o/ e bit setting is valid in asynchronous mode when the pe bit is set to 1 to enable the adding and checking of a parity bit. the o/ e setting is ignored in synchronous mode, or when parity adding and checking is disabled in asynchronous mode. bit 4: o/ e e e e description 0 even parity * 1 (initial value) 1 odd parity * 2 notes: 1. when even parity is selected, the parity bit added to transmit data makes an even number of 1s in the transmitted character and parity bit combined. receive data must have an even number of 1s in the received character and parity bit combined. 2. when odd parity is selected, the parity bit added to transmit data makes an odd number of 1s in the transmitted character and parity bit combined. receive data must have an odd number of 1s in the received character and parity bit combined.
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 463 of 872 rej09b0325-0300 bit 3?stop bit length (stop): selects one or two stop bits in asynchronous mode. this setting is used only in asynchronous mode. in synchronous mode no stop bit is added, so the stop bit setting is ignored. bit 3: stop description 0 one stop bit * 1 (initial value) 1 two stop bits * 2 notes: 1. one stop bit (with value 1) is added at the end of each transmitted character. 2. two stop bits (with value 1) are added at the end of each transmitted character. in receiving, only the first stop bit is checked, regardless of the stop bit setting. if the second stop bit is 1 it is treated as a stop bit. if the second stop bit is 0 it is treated as the start bit of the next incoming character. bit 2?multiprocessor mode (mp): selects a multiprocessor format. when a multiprocessor format is selected, parity settings made by the pe and o/ e bits are ignored. the mp bit setting is valid only in asynchronous mode. it is ignored in synchronous mode. for further information on the multiprocessor communication function, see section 13.3.3, multiprocessor communication. bit 2: mp description 0 multiprocessor function disabled (initial value) 1 multiprocessor format selected bits 1 and 0?clock select 1 and 0 (cks1, cks0): these bits select the clock source of the on- chip baud rate generator. four clock sources are available: , /4, /16, and /64. for the relationship between the clock source, bit rate register setting, and baud rate, see section 13.2.8, bit rate register (brr). bit 1: cks1 bit 0: cks0 description 00 (initial value) 1 /4 10 /16 1 /64
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 464 of 872 rej09b0325-0300 13.2.6 serial control register (scr) scr enables the sci transmitter and receiver, enables or disables serial clock output in asynchronous mode, enables or disables interrupts, and selects the transmit/receive clock source. bit initial value read/write 7 tie 0 r/w 6 rie 0 r/w 5 te 0 r/w 4 re 0 r/w 3 mpie 0 r/w 0 cke0 0 r/w 2 teie 0 r/w 1 cke1 0 r/w transmit interrupt enable enables or disables transmit-data-empty interrupts (txi) clock enable 1/0 these bits select the sci clock source receive interrupt enable enables or disables receive-data-full interrupts (rxi) and receive-error interrupts (eri) transmit enable enables or disables the transmitter receive enable enables or disables the receiver multiprocessor interrupt enable enables or disables multiprocessor interrupts transmit-end interrupt enable enables or disables transmit- end interrupts (tei) the cpu can always read and write scr. scr is initialized to h'00 by a reset and in standby mode.
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 465 of 872 rej09b0325-0300 bit 7?transmit interrupt enable (tie): enables or disables the transmit-data-empty interrupt (txi) requested when the tdre flag in ssr is set to 1 due to transfer of serial transmit data from tdr to tsr. bit 7: tie description 0 transmit-data-empty interrupt request (txi) is disabled * (initial value) 1 transmit-data-empty interrupt request (txi) is enabled note: * txi interrupt requests can be cleared by reading the value 1 from the tdre flag, then clearing it to 0; or by clearing the tie bit to 0. bit 6?receive interrupt enable (rie): enables or disables the receive-data-full interrupt (rxi) requested when the rdrf flag is set to 1 in ssr due to transfer of serial receive data from rsr to rdr; also enables or disables the receive-error interrupt (eri). bit 6: rie description 0 receive-data-full (rxi) and receive-error (eri) interrupt requests are disabled * (initial value) 1 receive-data-full (rxi) and receive-error (eri) interrupt requests are enabled note: * rxi and eri interrupt requests can be cleared by reading the value 1 from the rdrf, fer, per, or orer flag, then clearing it to 0; or by clearing the rie bit to 0. bit 5?transmit enable (te): enables or disables the start of sci serial transmitting operations. bit 5: te description 0 transmitting disabled * 1 (initial value) 1 transmitting enabled * 2 notes: 1. the tdre bit is locked at 1 in ssr. 2. in the enabled state, serial transmitting starts when the tdre bit in ssr is cleared to 0 after writing of transmit data into tdr. select the transmit format in smr before setting the te bit to 1.
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 466 of 872 rej09b0325-0300 bit 4?receive enable (re): enables or disables the start of sci serial receiving operations. bit 4: re description 0 receiving disabled * 1 (initial value) 1 receiving enabled * 2 notes: 1. clearing the re bit to 0 does not affect the rdrf, fer, per, and orer flags. these flags retain their previous values. 2. in the enabled state, serial receiving starts when a start bit is detected in asynchronous mode, or serial clock input is detected in synchronous mode. select the receive format in smr before setting the re bit to 1. bit 3?multiprocessor interrupt enable (mpie): enables or disables multiprocessor interrupts. the mpie setting is valid only in asynchronous mode, and only if the mp bit is set to 1 in smr. the mpie setting is ignored in synchronous mode or when the mp bit is cleared to 0. bit 3: mpie description 0 multiprocessor interrupts are disabled (normal receive operation) (initial value) [clearing conditions] ? the mpie bit is cleared to 0. ? mpb = 1 in received data. 1 multiprocessor interrupts are enabled * receive-data-full interrupts (rxi), receive-error interrupts (eri), and setting of the rdrf, fer, and orer status flags in ssr are disabled until data with the multiprocessor bit set to 1 is received. note: * the sci does not transfer receive data from rsr to rdr, does not detect receive errors, and does not set the rdrf, fer, and orer flags in ssr. when it receives data in which mpb = 1, the sci sets the mpb bit to 1 in ssr, automatically clears the mpie bit to 0, enables rxi and eri interrupts (if the rie bit is set to 1 in scr), and allows the fer and orer flags to be set. bit 2?transmit-end interrupt enable (teie): enables or disables the transmit-end interrupt (tei) requested if tdr does not contain new transmit data when the msb is transmitted. bit 2: teie description 0 transmit-end interrupt requests (tei) are disabled * (initial value) 1 transmit-end interrupt requests (tei) are enabled * note: * tei interrupt requests can be cleared by reading the value 1 from the tdre flag in ssr, then clearing the tdre flag to 0, thereby also clearing the tend flag to 0; or by clearing the teie bit to 0.
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 467 of 872 rej09b0325-0300 bits 1 and 0?clock enable 1 and 0 (cke1, cke0): these bits select the sci clock source and enable or disable clock output from the sck pin. depending on the settings of cke1 and cke0, the sck pin can be used for generic input/output, serial clock output, or serial clock input. the cke0 setting is valid only in asynchronous mode, and only when the sci is internally clocked (cke1 = 0). the cke0 setting is ignored in synchronous mode, or when an external clock source is selected (cke1 = 1). select the sci operating mode in smr before setting the cke1 and cke0 bits. for further details on selection of the sci clock source, see table 13.9 in section 13.3, operation. bit 1: cke1 bit 0: cke0 description 0 0 asynchronous mode internal clock, sck pin available for generic input/output * 1 synchronous mode internal clock, sck pin used for serial clock output * 1 1 asynchronous mode internal clock, sck pin used for clock output * 2 synchronous mode internal clock, sck pin used for serial clock output 1 0 asynchronous mode external clock, sck pin used for clock input * 3 synchronous mode external clock, sck pin used for serial clock input 1 asynchronous mode external clock, sck pin used for clock input * 3 synchronous mode external clock, sck pin used for serial clock input notes: 1. initial value 2. the output clock frequency is the same as the bit rate. 3. the input clock frequency is 16 times the bit rate.
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 468 of 872 rej09b0325-0300 13.2.7 serial status register (ssr) ssr is an 8-bit register containing multiprocessor bit values, and status flags that indicate sci operating status. bit initial value read/write 7 tdre 1 r/(w) 6 rdrf 0 r/(w) 5 orer 0 r/(w) 4 fer 0 r/(w) 3 per 0 r/(w) 0 mpbt 0 r/w 2 tend 1 r 1 mpb 0 r transmit data register empty status flag indicating that transmit data has been transferred from tdr into tsr and new data can be written in tdr multiprocessor bit transfer value of multi- processor bit to be transmitted receive data register full status flag indicating that data has been received and stored in rdr overrun error status flag indicating detection of a receive overrun error framing error status flag indicating detection of a receive framing error parity error status flag indicating detection of a receive parity error transmit end status flag indicating end of transmission * note: * only 0 can be written, to clear the flag. **** multiprocessor bit stores the received multiprocessor bit value the cpu can always read and write ssr, but cannot write 1 in the tdre, rdrf, orer, per, and fer flags. these flags can be cleared to 0 only if they have first been read while set to 1. the tend and mpb flags are read-only bits that cannot be written. ssr is initialized to h'84 by a reset and in standby mode.
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 469 of 872 rej09b0325-0300 bit 7?transmit data register empty (tdre): indicates that the sci has loaded transmit data from tdr into tsr and the next serial transmit data can be written in tdr. bit 7: tdre description 0 tdr contains valid transmit data [clearing conditions] ? software reads tdre while it is set to 1, then writes 0. ? the dmac writes data in tdr. 1 tdr does not contain valid transmit data (initial value) [setting conditions] ? the chip is reset or enters standby mode. ? the te bit in scr is cleared to 0. ? tdr contents are loaded into tsr, so new data can be written in tdr. bit 6?receive data register full (rdrf): indicates that rdr contains new receive data. bit 6: rdrf description 0 rdr does not contain new receive data (initial value) [clearing conditions] ? the chip is reset or enters standby mode. ? software reads rdrf while it is set to 1, then writes 0. ? the dmac reads data from rdr. 1 rdr contains new receive data [setting condition] when serial data is received normally and transferred from rsr to rdr. note: the rdr contents and rdrf flag are not affected by detection of receive errors or by clearing of the re bit to 0 in scr. they retain their previous values. if the rdrf flag is still set to 1 when reception of the next data ends, an overrun error occurs and receive data is lost.
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 470 of 872 rej09b0325-0300 bit 5?overrun error (orer): indicates that data reception ended abnormally due to an overrun error. bit 5: orer description 0 receiving is in progress or has ended normally (initial value) * 1 [clearing conditions] ? the chip is reset or enters standby mode. ? software reads orer while it is set to 1, then writes 0. 1 a receive overrun error occurred * 2 [setting condition] reception of the next serial data ends when rdrf = 1. notes: 1. clearing the re bit to 0 in scr does not affect the orer flag, which retains its previous value. 2. rdr continues to hold the receive data before the overrun error, so subsequent receive data is lost. serial receiving cannot continue while the orer flag is set to 1. in synchronous mode, serial transmitting is also disabled. bit 4?framing error (fer): indicates that data reception ended abnormally due to a framing error in asynchronous mode. bit 4: fer description 0 receiving is in progress or has ended normally (initial value) * 1 [clearing conditions] ? the chip is reset or enters standby mode. ? software reads fer while it is set to 1, then writes 0. 1 a receive framing error occurred * 2 [setting condition] the stop bit at the end of receive data is checked and found to be 0. notes: 1. clearing the re bit to 0 in scr does not affect the fer flag, which retains its previous value. 2. when the stop bit length is 2 bits, only the first bit is checked. the second stop bit is not checked. when a framing error occurs the sci transfers the receive data into rdr but does not set the rdrf flag. serial receiving cannot continue while the fer flag is set to 1. in synchronous mode, serial transmitting is also disabled.
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 471 of 872 rej09b0325-0300 bit 3?parity error (per): indicates that data reception ended abnormally due to a parity error in asynchronous mode. bit 3: per description 0 receiving is in progress or has ended normally * 1 (initial value) [clearing conditions] ? the chip is reset or enters standby mode. ? software reads per while it is set to 1, then writes 0. 1 a receive parity error occurred * 2 [setting condition] the number of 1s in receive data, including the parity bit, does not match the even or odd parity setting of o/ e in smr. notes: 1. clearing the re bit to 0 in scr does not affect the per flag, which retains its previous value. 2. when a parity error occurs the sci transfers the receive data into rdr but does not set the rdrf flag. serial receiving cannot continue while the per flag is set to 1. in synchronous mode, serial transmitting is also disabled. bit 2?transmit end (tend): indicates that when the last bit of a serial character was transmitted tdr did not contain new transmit data, so transmission has ended. the tend flag is a read-only bit and cannot be written. bit 2: tend description 0 transmission is in progress [clearing conditions] ? software reads tdre while it is set to 1, then writes 0 in the tdre flag. ? the dmac writes data in tdr. 1 end of transmission (initial value) [setting conditions] ? the chip is reset or enters standby mode. ? the te bit is cleared to 0 in scr. ? tdre is 1 when the last bit of a serial character is transmitted.
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 472 of 872 rej09b0325-0300 bit 1?multiprocessor bit (mpb): stores the value of the multiprocessor bit in receive data when a multiprocessor format is used in asynchronous mode. mpb is a read-only bit and cannot be written. bit 1: mpb description 0 multiprocessor bit value in receive data is 0 * (initial value) 1 multiprocessor bit value in receive data is 1 note: * if the re bit is cleared to 0 when a multiprocessor format is selected, mpb retains its previous value. bit 0?multiprocessor bit transfer (mpbt): stores the value of the multiprocessor bit added to transmit data when a multiprocessor format is selected for transmitting in asynchronous mode. the mpbt setting is ignored in synchronous mode, when a multiprocessor format is not selected, or when the sci is not transmitting. bit 0: mpbt description 0 multiprocessor bit value in transmit data is 0 (initial value) 1 multiprocessor bit value in transmit data is 1 13.2.8 bit rate register (brr) brr is an 8-bit register that, together with the cks1 and cks0 bits in smr that select the baud rate generator clock source, determines the serial communication bit rate. bit initial value read/write 7 1 r/w 6 1 r/w 5 1 r/w 4 1 r/w 3 1 r/w 0 1 r/w 2 1 r/w 1 1 r/w the cpu can always read and write brr. brr is initialized to h'ff by a reset and in standby mode. the two sci channels have independent baud rate generator control, so different values can be set in the two channels. table 13.3 shows examples of brr settings in asynchronous mode. table 13.4 shows examples of brr settings in synchronous mode.
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 473 of 872 rej09b0325-0300 table 13.3 examples of bit rates and brr settings in asynchronous mode (mhz) 2 2.097152 2.4576 3 bit rate (bits/s) n n error (%) n n error (%) n n error (%) n n error (%) 110 1 141 0.03 1 148 ? 0.04 1 174 ? 0.26 1 212 0.03 150 1 103 0.16 1 108 0.21 1 127 0.00 1 155 0.16 300 0 207 0.16 0 217 0.21 0 255 0.00 1 77 0.16 600 0 103 0.16 0 108 0.21 0 127 0.00 0 155 0.16 1200 0 51 0.16 0 54 ? 0.70 0 63 0.00 0 77 0.16 2400 0 25 0.16 0 26 1.14 0 31 0.00 0 38 0.16 4800 0 12 0.16 0 13 ? 2.48 0 15 0.00 0 19 ? 2.34 9600 0 6 ? 6.99 0 6 ? 2.48 0 7 0.00 0 9 ? 2.34 19200 0 2 8.51 0 2 13.78 0 3 0.00 0 4 ? 2.34 31250 0 1 0.00 0 1 4.86 0 1 22.88 0 2 0.00 38400 0 1 ? 18.62 0 1 ? 14.67 0 1 0.00 0 1 22.07 (mhz) 3.6864 4 4.9152 5 bit rate (bits/s) nn error (%) nn error (%) nn error (%) nn error (%) 110 2 64 0.70 2 70 0.03 2 86 0.31 2 88 ? 0.25 150 1 191 0.00 1 207 0.16 1 255 0.00 2 64 0.16 300 1 95 0.00 1 103 0.16 1 127 0.00 1 129 0.16 600 0 191 0.00 0 207 0.16 0 255 0.00 1 64 0.16 1200 0 95 0.00 0 103 0.16 0 127 0.00 0 129 0.16 2400 0 47 0.00 0 51 0.16 0 63 0.00 0 64 0.16 4800 0 23 0.00 0 25 0.16 0 31 0.00 0 32 ? 1.36 9600 0 11 0.00 0 12 0.16 0 15 0.00 0 15 1.73 19200 0 5 0.00 0 6 ? 6.99 0 7 0.00 0 7 1.73 31250 0 3 ? 7.84 0 3 0.00 0 4 ? 1.70 0 4 0.00 38400 0 2 0.00 0 2 8.51 0 3 0.00 0 3 1.73
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 474 of 872 rej09b0325-0300 (mhz) 6 6.144 7.3728 8 bit rate (bits/s) n n error (%) n n error (%) n n error (%) n n error (%) 110 2 106 ? 0.44 2 108 0.08 2 130 ? 0.07 2 141 0.03 150 2 77 0.16 2 79 0.00 2 95 0.00 2 103 0.16 300 1 155 0.16 1 159 0.00 1 191 0.00 1 207 0.16 600 1 77 0.16 1 79 0.00 1 95 0.00 1 103 0.16 1200 0 155 0.16 0 159 0.00 0 191 0.00 0 207 0.16 2400 0 77 0.16 0 79 0.00 0 95 0.00 0 103 0.16 4800 0 38 0.16 0 39 0.00 0 47 0.00 0 51 0.16 9600 0 19 ? 2.34 0 19 0.00 0 23 0.00 0 25 0.16 19200 0 9 ? 2.34 0 9 0.00 0 11 0.00 0 12 0.16 31250 0 5 0.00 0 5 2.40 0 6 5.33 0 7 0.00 38400 0 4 ? 2.34 0 4 0.00 0 5 0.00 0 6 ? 6.99 (mhz) 9.8304 10 12 12.288 bit rate (bits/s) nn error (%) nn error (%) nn error (%) nn error (%) 110 2 174 ? 0.26 2 177 ? 0.25 2 212 0.03 2 217 0.08 150 2 127 0.00 2 129 0.16 2 155 0.16 2 159 0.00 300 1 255 0.00 2 64 0.16 2 77 0.16 2 79 0.00 600 1 127 0.00 1 129 0.16 1 155 0.16 1 159 0.00 1200 0 255 0.00 1 64 0.16 1 77 0.16 1 79 0.00 2400 0 127 0.00 0 129 0.16 0 155 0.16 0 159 0.00 4800 0 63 0.00 0 64 0.16 0 77 0.16 0 79 0.00 9600 0 31 0.00 0 32 ? 1.36 0 38 0.16 0 39 0.00 19200 0 15 0.00 0 15 1.73 0 19 ? 2.34 0 19 0.00 31250 0 9 ? 1.70 0 9 0.00 0 11 0.00 0 11 2.40 38400 0 7 0.00 0 7 1.73 0 9 ? 2.34 0 9 0.00
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 475 of 872 rej09b0325-0300 (mhz) 13 14 14.7456 16 bit rate (bits/s) n n error (%) n n error (%) n n error (%) n n error (%) 110 2 230 ? 0.08 2 248 ? 0.17 3 64 0.70 3 70 0.03 150 2 168 0.16 2 181 0.16 2 191 0.00 2 207 0.16 300 2 84 ? 0.43 2 90 0.16 2 95 0.00 2 103 0.16 600 1 168 0.16 1 181 0.16 1 191 0.00 1 207 0.16 1200 1 84 ? 0.43 1 90 0.16 1 95 0.00 1 103 0.16 2400 0 168 0.16 0 181 0.16 0 191 0.00 0 207 0.16 4800 0 84 ? 0.43 0 90 0.16 0 95 0.00 0 103 0.16 9600 0 41 0.76 0 45 ? 0.93 0 47 0.00 0 51 0.16 19200 0 20 0.76 0 22 ? 0.93 0 23 0.00 0 25 0.16 31250 0 12 0.00 0 13 0.00 0 14 ? 1.70 0 15 0.00 38400 0 10 ? 3.82 0 10 3.57 0 11 0.00 0 12 0.16 (mhz) 18 20 25 bit rate (bits/s) nn error (%) nn error (%) nn error (%) 110 3 79 ? 0.12 3 88 ? 0.25 3 110 ? 0.02 150 2 233 0.16 3 64 0.16 3 80 0.47 300 2 116 0.16 2 129 0.16 2 162 ? 0.15 600 1 233 0.16 2 64 0.16 2 80 0.47 1200 1 116 0.16 1 129 0.16 1 162 ? 0.15 2400 0 233 0.16 1 64 0.16 1 80 0.47 4800 0 116 0.16 0 129 0.16 0 162 ? 0.15 9600 0 58 ? 0.69 0 64 0.16 0 80 0.47 19200 0 28 1.02 0 32 ? 1.36 0 40 ? 0.76 31250 0 17 0.00 0 19 0.00 0 24 0.00 38400 0 14 ? 2.34 0 15 1.73 0 19 1.73
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 476 of 872 rej09b0325-0300 table 13.4 examples of bit rates and brr settings in synchronous mode (mhz) 2 4 8 10 13 16 18 20 25 bit rate (bits/s)nn nn nn nn nn nn nn nn nn 110 3 70 ?? ?? ?? ?? ?? ?? ?? ?? 250 2 124 2 249 3 124 ?? 3 202 3 249 ?? ?? ?? 500 1 249 2 124 2 249 ?? 3 101 3 124 3 140 3 155 ?? 1 k 1 124 1 249 2 124 ?? 2 202 2 249 3 69 3 77 3 97 2.5 k 0 199 1 99 1 199 1 249 2 80 2 99 2 112 2 124 2 155 5 k 0 99 0 199 1 99 1 124 1 162 1 199 1 224 1 249 2 77 10 k 0 49 0 99 0 199 0 249 1 80 1 99 1 112 1 124 1 155 25 k 0 19 0 39 0 79 0 99 0 129 0 159 0 179 0 199 0 249 50 k 0 9 0 19 0 39 0 49 0 64 0 79 0 89 0 99 0 124 100 k 0 4 0 9 0 19 0 24 ?? 039 044 049 062 250 k 0 1 0 3 0 7 0 9 0 12 0 15 0 17 0 19 0 24 500 k 0 0 * 01 03 04 ?? 07 08 09 ?? 1 m 0 0 * 01 ?? ?? 03 04 04 ?? 2 m 0 0 * ?? ?? 01 ?? ?? ?? 2.5 m ?? 00 * ?? ?? ?? ?? ?? 4 m 0 0 * ?? ?? ?? legend: blank: no setting available ? : setting possible, but error occurs * : continuous transmit/receive not possible note: settings with an error of 1% or less are recommended.
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 477 of 872 rej09b0325-0300 the brr setting is calculated as follows: asynchronous mode: n = 64 2 2n ? 1 b 10 6 ? 1 synchronous mode: n = 8 2 2n ? 1 b 10 6 ? 1 b: bit rate (bits/s) n: brr setting for baud rate generator (0 n 255) : system clock frequency (mhz) n: baud rate generator clock source (n = 0, 1, 2, 3) (for the clock sources and values of n, see the following table.) smr settings n clock source cks1 cks0 0 00 1 /4 0 1 2 /16 1 0 3 /64 1 1 the bit rate error in asynchronous mode is calculated as follows. error (%) = (n + 1) b 64 2 2n ? 1 ? 1 100 10 6
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 478 of 872 rej09b0325-0300 table 13.5 indicates the maximum bit rates in asynchronous mode for various system clock frequencies. tables 13.6 and 13.7 indicate the maximum bit rates with external clock input. table 13.5 maximum bit rates for various frequencies (asynchronous mode) settings (mhz) maximum bit rate (bits/s) n n 2 62500 0 0 2.097152 65536 0 0 2.4576 76800 0 0 3 93750 0 0 3.6864 115200 0 0 4 125000 0 0 4.9152 153600 0 0 5 156250 0 0 6 187500 0 0 6.144 192000 0 0 7.3728 230400 0 0 8 250000 0 0 9.8304 307200 0 0 10 312500 0 0 12 375000 0 0 12.288 384000 0 0 14 437500 0 0 14.7456 460800 0 0 16 500000 0 0 17.2032 537600 0 0 18 562500 0 0 20 625000 0 0 25 781250 0 0
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 479 of 872 rej09b0325-0300 table 13.6 maximum bit rates with external clock input (asynchronous mode) (mhz) external input clock (mhz) maximum bit rate (bits/s) 2 0.5000 31250 2.097152 0.5243 32768 2.4576 0.6144 38400 3 0.7500 46875 3.6864 0.9216 57600 4 1.0000 62500 4.9152 1.2288 76800 5 1.2500 78125 6 1.5000 93750 6.144 1.5360 96000 7.3728 1.8432 115200 8 2.0000 125000 9.8304 2.4576 153600 10 2.5000 156250 12 3.0000 187500 12.288 3.0720 192000 14 3.5000 218750 14.7456 3.6864 230400 16 4.0000 250000 17.2032 4.3008 268800 18 4.5000 281250 20 5.0000 312500 25 6.2500 390625
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 480 of 872 rej09b0325-0300 table 13.7 maximum bit rates with external clock input (synchronous mode) (mhz) external input clock (mhz) maximum bit rate (bits/s) 2 0.3333 333333.3 4 0.6667 666666.7 6 1.0000 1000000.0 8 1.3333 1333333.3 10 1.6667 1666666.7 12 2.0000 2000000.0 14 2.3333 2333333.3 16 2.6667 2666666.7 18 3.0000 3000000.0 20 3.3333 3333333.3 25 4.1667 4166666.7
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 481 of 872 rej09b0325-0300 13.3 operation 13.3.1 overview the sci has an asynchronous mode in which characters are synchronized individually, and a synchronous mode in which communication is synchronized with clock pulses. serial communication is possible in either mode. asynchronous or synchronous mode and the communication format are selected in smr, as shown in table 13.8. the sci clock source is selected by the c/ a bit in smr and the cke1 and cke0 bits in scr, as shown in table 13.9. asynchronous mode: ? data length is selectable: 7 or 8 bits. ? parity and multiprocessor bits are selectable. so is the stop bit length (1 or 2 bits). these selections determine the communication format and character length. ? in receiving, it is possible to detect framing errors, parity errors, overrun errors, and the break state. ? an internal or external clock can be selected as the sci clock source. ? when an internal clock is selected, the sci operates using the on-chip baud rate generator, and can output a serial clock signal with a frequency matching the bit rate. ? when an external clock is selected, the external clock input must have a frequency 16 times the bit rate. (the on-chip baud rate generator is not used.) synchronous mode: ? the communication format has a fixed 8-bit data length. ? in receiving, it is possible to detect overrun errors. ? an internal or external clock can be selected as the sci clock source. ? when an internal clock is selected, the sci operates using the on-chip baud rate generator, and outputs a serial clock signal to external devices. ? when an external clock is selected, the sci operates on the input serial clock. the on-chip baud rate generator is not used.
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 482 of 872 rej09b0325-0300 table 13.8 smr settings and serial communication formats smr settings sci communication format bit 7: c/ a a a a bit 6: chr bit 2: mp bit 5: pe bit 3: stop mode data length multi- processor bit parity bit stop bit length 00000 8-bit dataabsentabsent1 bit 12 bits 1 0 present 1 bit 12 bits 1 0 0 7-bit data absent 1 bit 12 bits 1 0 present 1 bit 1 asynchronous mode 2 bits 01 ? 0 8-bit data present absent 1 bit 12 bits 1 0 7-bit data 1 bit 1 asynchronous mode (multi- processor format) 2 bits 1 ???? synchronous mode 8-bit data absent none table 13.9 smr and scr settings and sci clock source selection smr scr settings sci transmit/receive clock bit 7: c/ a a a a bit 1: cke1 bit 0: cke0 mode clock source sck pin function 0 0 0 sci does not use the sck pin 1 internal outputs a clock with frequency matching the bit rate 10 1 asynchronous mode external inputs a clock with frequency 16 times the bit rate 100 1 internal outputs the serial clock 10 1 synchronous mode external inputs the serial clock
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 483 of 872 rej09b0325-0300 13.3.2 operation in asynchronous mode in asynchronous mode each transmitted or received character begins with a start bit and ends with a stop bit. serial communication is synchronized one character at a time. the transmitting and receiving sections of the sci are independent, so full duplex communication is possible. the transmitter and receiver are both double buffered, so data can be written and read while transmitting and receiving are in progress, enabling continuous transmitting and receiving. figure 13.2 shows the general format of asynchronous serial communication. in asynchronous serial communication the communication line is normally held in the mark (high) state. the sci monitors the line and starts serial communication when the line goes to the space (low) state, indicating a start bit. one serial character consists of a start bit (low), data (lsb first), parity bit (high or low), and stop bit (high), in that order. when receiving in asynchronous mode, the sci synchronizes at the falling edge of the start bit. the sci samples each data bit on the eighth pulse of a clock with a frequency 16 times the bit rate. receive data is latched at the center of each bit. serial data 0 1 1 1 idle (mark) state 1 d0 d1 d2 d3 d4 d5 d6 d7 0/1 (lsb) (msb) start bit transmit or receive data parity bit stop bit one unit of data (character or frame) 1 bit 7 bits or 8 bits 1 bit or no bit 1 bit or 2 bits figure 13.2 data format in asynchronous communication (example: 8-bit data with parity and 2 stop bits)
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 484 of 872 rej09b0325-0300 communication formats table 13.10 shows the 12 communication formats that can be selected in asynchronous mode. the format is selected by settings in smr. table 13.10 serial communication formats (asynchronous mode) smr settings serial communication format and frame length chrpempstop 123456789101112 0000 s 8-bit data stop 0001 s 8-bit data stop stop 0100 s 8-bit data pstop 0101 s 8-bit data p stop stop 1000 s 7-bit data stop 1001 s 7-bit data stop stop 1100 s 7-bit data pstop 1101 s 7-bit data p stop stop 0 ? 10 s 8-bit data mpb stop 0 ? 11 s 8-bit data mpb stop stop 1 ? 10 s 7-bit data mpb stop 1 ? 11 s 7-bit data mpb stop stop legend: s: start bit stop: stop bit p: parity bit mpb: multiprocessor bit
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 485 of 872 rej09b0325-0300 clock an internal clock generated by the on-chip baud rate generator or an external clock input from the sck pin can be selected as the sci transmit/receive clock. the clock source is selected by the c/ a bit in smr and bits cke1 and cke0 in scr. see table 13.9. when an external clock is input at the sck pin, it must have a frequency equal to 16 times the desired bit rate. when the sci operates on an internal clock, it can output a clock signal at the sck pin. the frequency of this output clock is equal to the bit rate. the phase is aligned as in figure 13.3 so that the rising edge of the clock occurs at the center of each transmit data bit. 0 d0d1d2d3d4d5d6d70/1 1 1 1 frame figure 13.3 phase relationship between output clock and serial data (asynchronous mode) transmitting and receiving data sci initialization (asynchronous mode): before transmitting or receiving, clear the te and re bits to 0 in scr, then initialize the sci as follows. when changing the communication mode or format, always clear the te and re bits to 0 before following the procedure given below. clearing te to 0 sets the tdre flag to 1 and initializes tsr. clearing re to 0, however, does not initialize the rdrf, per, fer, and orer flags and rdr, which retain their previous contents. when an external clock is used, the clock should not be stopped during initialization or subsequent operation. sci operation becomes unreliable if the clock is stopped. figure 13.4 is a sample flowchart for initializing the sci.
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 486 of 872 rej09b0325-0300 clear te and re bits to 0 in scr no yes 1. 2. 3. 4. select the communication format in smr. write the value corresponding to the bit rate in brr. this step is not necessary when an external clock is used. select communication format in smr 1 set value in brr 2 3 set te or re bit to 1 in scr set rie, tie, teie, and mpie bits as necessary 4 1 bit interval elapsed? wait wait for at least the interval required to transmit or receive 1 bit, then set the te or re bit to 1 in scr. set the rie, tie, teie, and mpie bits as necessary. setting the te or re bit enables the sci to use the txd or rxd pin. start of initialization set cke1 and cke0 bits in scr (leaving te and re bits cleared to 0) select the clock source in scr. clear the rie, tie, teie, mpie, te, and re bits to 0. if clock output is selected in asynchronous mode, clock output starts immediately after the setting is made in scr. transmitting or receiving figure 13.4 sample flowchart for sci initialization
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 487 of 872 rej09b0325-0300 transmitting serial data (asynchronous mode): figure 13.5 shows a sample flowchart for transmitting serial data and indicates the procedure to follow. start transmitting read tdre flag in ssr tdre = 1? write transmit data in tdr and clear tdre flag to 0 in ssr all data transmitted? end 1 2 3 no yes no yes sci initialization: the transmit data output function of the txd pin is selected automatically. sci status check and transmit data write: read ssr, check that the tdre flag is 1, then write transmit data in tdr and clear the tdre flag to 0. read tend flag in ssr tend = 1? no yes output break signal? no yes clear te bit to 0 in scr 4 1. 2. 3. 4. clear dr bit to 0, set ddr bit to 1 initialize to continue transmitting serial data: after checking that the tdre flag is 1, indicating that data can be written, write data in tdr, then clear the tdre flag to 0. when the dmac is activated by a transmit- data-empty interrupt request (txi) to write data in tdr, the tdre flag is checked and cleared automatically. to output a break signal at the end of serial transmission: set the ddr bit to 1 and clear the dr bit to 0 (ddr and dr are i/o port registers), then clear the te bit to 0 in scr. figure 13.5 sample flowchart for transmitting serial data
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 488 of 872 rej09b0325-0300 in transmitting serial data, the sci operates as follows. 1. the sci monitors the tdre flag in ssr. when the tdre flag is cleared to 0 the sci recognizes that tdr contains new data, and loads this data from tdr into tsr. 2. after loading the data from tdr into tsr, the sci sets the tdre flag to 1 and starts transmitting. if the tie bit is set to 1 in scr, the sci requests a transmit-data-empty interrupt (txi) at this time. serial transmit data is transmitted in the following order from the txd pin: a. start bit: one 0 bit is output. b. transmit data: 7 or 8 bits are output, lsb first. c. parity bit or multiprocessor bit: one parity bit (even or odd parity) or one multiprocessor bit is output. formats in which neither a parity bit nor a multiprocessor bit is output can also be selected. d. stop bit: one or two 1 bits (stop bits) are output. e. mark state: output of 1 bits continues until the start bit of the next transmit data. 3. the sci checks the tdre flag when it outputs the stop bit. if the tdre flag is 0, the sci loads new data from tdr into tsr, outputs the stop bit, then begins serial transmission of the next frame. if the tdre flag is 1, the sci sets the tend flag to 1 in ssr, outputs the stop bit, then continues output of 1 bits in the mark state. if the teie bit is set to 1 in scr, a transmit- end interrupt (tei) is requested at this time. figure 13.6 shows an example of sci transmit operation in asynchronous mode. 1 start bit 0 d0 d1 d7 0/1 stop bit 1 data parity bit start bit 0 d0 d1 d7 0/1 stop bit 1 data parity bit 1 idle (mark) state tdre tend txi interrupt request txi interrupt handler writes data in tdr and clears tdre flag to 0 1 frame tei interrupt request txi interrupt request figure 13.6 example of sci transmit operation in asynchronous mode (8-bit data with parity and 1 stop bit)
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 489 of 872 rej09b0325-0300 receiving serial data (asynchronous mode): figure 13.7 shows a sample flowchart for receiving serial data and indicates the procedure to follow. start receiving read rdrf flag in ssr rdrf = 1? read receive data from rdr, and clear rdrf flag to 0 in ssr per fer orer = 1? clear re bit to 0 in scr finished receiving? end error handling (continued on next page) 1 4 no yes yes no no yes 1. 2, 3. 4. 5. sci initialization: the receive data function of the rxd pin is selected automatically. receive error handling and break detection: if a receive error occurs, read the orer, per, and fer flags in ssr to identify the error. after executing the necessary error handling, clear the orer, per, and fer flags all to 0. receiving cannot resume if any of the orer, per, and fer flags remains set to 1. when a framing error occurs, the rxd pin can be read to detect the break state. sci status check and receive data read: read ssr, check that rdrf is set to 1, then read receive data from rdr and clear the rdrf flag to 0. notification that the rdrf flag has changed from 0 to 1 can also be given by the rxi interrupt. to continue receiving serial data: check the rdrf flag, read rdr, and clear the rdrf flag to 0 before the stop bit of the current frame is received. if the dmac is activated by an rxi interrupt to read the rdr value, the rdrf flag is cleared automatically. read orer, per, and fer flags in ssr 2 5 initialize ? 3 figure 13.7 sample flowchart for receiving serial data (1)
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 490 of 872 rej09b0325-0300 no no no no yes yes yes yes framing error handling per = 1? orer = 1? overrun error handling fer = 1? break? error handling parity error handling clear orer, per, and fer flags to 0 in ssr clear re bit to 0 in scr end 3 figure 13.7 sample flowchart for receiving serial data (2)
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 491 of 872 rej09b0325-0300 in receiving, the sci operates as follows. 1. the sci monitors the receive data line. when it detects a start bit, the sci synchronizes internally and starts receiving. 2. receive data is stored in rsr in order from lsb to msb. 3. the parity bit and stop bit are received. after receiving, the sci makes the following checks: a. parity check: the number of 1s in the receive data must match the even or odd parity setting of the o/ e bit in smr. b. stop bit check: the stop bit value must be 1. if there are two stop bits, only the first stop bit is checked. c. status check: the rdrf flag must be 0 so that receive data can be transferred from rsr into rdr. if these checks all pass, the rdrf flag is set to 1 and the received data is stored in rdr. if one of the checks fails (receive error) * , the sci operates as indicated in table 13.11. note: * when a receive error occurs, further receiving is disabled. in receiving, the rdrf flag is not set to 1. be sure to clear the error flags to 0. 4. when the rdrf flag is set to 1, if the rie bit is set to 1 in scr, a receive-data-full interrupt (rxi) is requested. if the orer, per, or fer flag is set to 1 and the rie bit in scr is also set to 1, a receive-error interrupt (eri) is requested. table 13.11 receive error conditions receive error abbreviation condition data transfer overrun error orer receiving of next data ends while rdrf flag is still set to 1 in ssr receive data not transferred from rsr to rdr framing error fer stop bit is 0 receive data transferred from rsr to rdr parity error per parity of receive data differs from even/odd parity setting in smr receive data transferred from rsr to rdr
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 492 of 872 rej09b0325-0300 figure 13.8 shows an example of sci receive operation in asynchronous mode. 1 start bit 0 d0 d1 d7 0/1 stop bit 1 data parity bit start bit 0 d0 d1 d7 0/1 stop bit 1 data parity bit 1 idle (mark) state rdrf fer 1 frame framing error, eri request rxi interrupt handler reads data in rdr and clears rdrf flag to 0 rxi request figure 13.8 example of sci receive operation (8-bit data with parity and one stop bit) 13.3.3 multiprocessor communication the multiprocessor communication function enables several processors to share a single serial communication line. the processors communicate in asynchronous mode using a format with an additional multiprocessor bit (multiprocessor format). in multiprocessor communication, each receiving processor is addressed by an id. a serial communication cycle consists of an id-sending cycle that identifies the receiving processor, and a data-sending cycle. the multiprocessor bit distinguishes id-sending cycles from data-sending cycles. the transmitting processor starts by sending the id of the receiving processor with which it wants to communicate as data with the multiprocessor bit set to 1. next the transmitting processor sends transmit data with the multiprocessor bit cleared to 0. receiving processors skip incoming data until they receive data with the multiprocessor bit set to 1. when they receive data with the multiprocessor bit set to 1, receiving processors compare the data with their ids. the receiving processor with a matching id continues to receive further incoming data. processors with ids not matching the received data skip further incoming data until they again receive data with the multiprocessor bit set to 1. multiple processors can send and receive data in this way. figure 13.9 shows an example of communication among different processors using a multiprocessor format.
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 493 of 872 rej09b0325-0300 communication formats four formats are available. parity-bit settings are ignored when a multiprocessor format is selected. for details see table 13.10. clock see the description of asynchronous mode. transmitting processor receiving processor a serial communication line receiving processor b receiving processor c receiving processor d (id = 01) (id = 02) (id = 03) (id = 04) serial data h'01 h'aa (mpb = 1) (mpb = 0) id-sending cycle: receiving processor address data-sending cycle: data sent to receiving processor specified by id legend: mpb: multiprocessor bit figure 13.9 example of communication among processors using multiprocessor format (sending data h'aa to receiving processor a)
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 494 of 872 rej09b0325-0300 transmitting and receiving data transmitting multiprocessor serial data: figure 13.10 shows a sample flowchart for transmitting multiprocessor serial data and indicates the procedure to follow. no no no no yes yes yes yes initialize start transmitting read tdre flag in ssr tdre = 1? write transmit data in tdr and set mpbt bit in ssr clear tdre flag to 0 all data transmitted? read tend flag in ssr tend = 1? 1 2 3 4 1. 2. 3. 4. sci initialization: the transmit data output function of the txd pin is selected automatically. sci status check and transmit data write: read ssr, check that the tdre flag is 1, then write transmit data in tdr. also set the mpbt flag to 0 or 1 in ssr. finally, clear the tdre flag to 0. to continue transmitting serial data: after checking that the tdre flag is 1, indicating that data can be written, write data in tdr, then clear the tdre flag to 0. when the dmac is activated by a transmit-data-empty interrupt request (txi) to write data in tdr, the tdre flag is checked and cleared automatically. to output a break signal at the end of serial transmission: set the ddr bit to 1 and clear the dr bit to 0 (ddr and dr are i/o port registers), then clear the te bit to 0 in scr. output break signal? clear dr bit to 0, set ddr bit to 1 clear te bit to 0 in scr end figure 13.10 sample flowchart for transmitting multiprocessor serial data
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 495 of 872 rej09b0325-0300 in transmitting serial data, the sci operates as follows. 1. the sci monitors the tdre flag in ssr. when the tdre flag is cleared to 0 the sci recognizes that tdr contains new data, and loads this data from tdr into tsr. 2. after loading the data from tdr into tsr, the sci sets the tdre flag to 1 and starts transmitting. if the tie bit in scr is set to 1, the sci requests a transmit-data-empty interrupt (txi) at this time. serial transmit data is transmitted in the following order from the txd pin: a. start bit: one 0 bit is output. b. transmit data: 7 or 8 bits are output, lsb first. c. multiprocessor bit: one multiprocessor bit (mpbt value) is output. d. stop bit: one or two 1 bits (stop bits) are output. e. mark state: output of 1 bits continues until the start bit of the next transmit data. 3. the sci checks the tdre flag when it outputs the stop bit. if the tdre flag is 0, the sci loads data from tdr into tsr, outputs the stop bit, then begins serial transmission of the next frame. if the tdre flag is 1, the sci sets the tend flag in ssr to 1, outputs the stop bit, then continues output of 1 bits in the mark state. if the teie bit is set to 1 in scr, a transmit-end interrupt (tei) is requested at this time. figure 13.11 shows an example of sci transmit operation using a multiprocessor format. 1 start bit 0 d0 d1 d7 0/1 stop bit 1 data multi- processor bit start bit 0 d0 d1 d7 0/1 stop bit 1 data 1 idle (mark) state tdre tend txi request txi interrupt handler writes data in tdr and clears tdre flag to 0 1 frame tei request multi- processor bit txi request figure 13.11 example of sci transmit operation (8-bit data with multiprocessor bit and one stop bit)
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 496 of 872 rej09b0325-0300 receiving multiprocessor serial data: figure 13.12 shows a sample flowchart for receiving multiprocessor serial data and indicates the procedure to follow. initialize start receiving read rdrf flag in ssr rdrf = 1? read receive data from rdr read orer and fer flags in ssr fer orer = 1 read rdrf flag in ssr rdrf = 1? read receive data from rdr finished receiving? clear re bit to 0 in scr error handling (continued on next page) end 1 2 4 5 1. 2. 3. 4. 5. sci initialization: the receive data function of the rxd pin is selected automatically. id receive cycle: set the mpie bit to 1 in scr. sci status check and id check: read ssr, check that the rdrf flag is set to 1, then read data from rdr and compare with the processor ? s own id. if the id does not match, set the mpie bit to 1 again and clear the rdrf flag to 0. if the id matches, clear the rdrf flag to 0. sci status check and data receiving: read ssr, check that the rdrf flag is set to 1, then read data from rdr. receive error handling and break detection: if a receive error occurs, read the orer and fer flags in ssr to identify the error. after executing the necessary error handling, clear the orer and fer flags both to 0. receiving cannot resume while either the orer or fer flag remains set to 1. when a framing error occurs, the rxd pin can be read to detect the break state. yes yes yes no yes yes no no no 3 set mpie bit to 1 in scr read orer and fer flags in ssr yes fer orer = 1 own id? no no figure 13.12 sample flowchart for receiving multiprocessor serial data (1)
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 497 of 872 rej09b0325-0300 no no yes no yes yes error handling orer = 1? overrun error handling fer = 1? break? framing error handling clear orer, per, and fer flags to 0 in ssr clear re bit to 0 in scr end 5 figure 13.12 sample flowchart for receiving multiprocessor serial data (2) figure 13.13 shows an example of sci receive operation using a multiprocessor format.
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 498 of 872 rej09b0325-0300 1 start bit 0 d0 d1 d7 1 stop bit 1 data (id1) mpb start bit 0 d0 d1 d7 0 stop bit 1 data (data1) mpb 1 idle (mark) state mpie rdrf rdr value id1 rxi request (multiprocessor interrupt) mpb detection mpie= 0 mpb detection mpie= 0 rxi handler reads rdr data and clears rdrf flag to 0 not own id, so mpie bit is set to 1 again no rxi request, rdr not updated a. own id does not match data 1 start bit 0 d0 d1 d7 1 stop bit 1 data (id2) mpb start bit 0 d0 d1 d7 0 stop bit 1 data (data2) mpb 1 idle (mark) state mpie rdrf rdr value id2 rxi request (multiprocessor interrupt) rxi interrupt handler reads rdr data and clears rdrf flag to 0 own id, so receiving continues, with data received by rxi interrupt handler mpie bit is set to 1 again b. own id matches data data 2 figure 13.13 example of sci receive operation (8-bit data with multiprocessor bit and one stop bit)
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 499 of 872 rej09b0325-0300 13.3.4 synchronous operation in synchronous mode, the sci transmits and receives data in synchronization with clock pulses. this mode is suitable for high-speed serial communication. the sci transmitter and receiver share the same clock but are otherwise independent, so full duplex communication is possible. the transmitter and receiver are also double buffered, so continuous transmitting or receiving is possible by reading or writing data while transmitting or receiving is in progress. figure 13.14 shows the general format in synchronous serial communication. serial clock serial data bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 lsb msb don ? t care don ? t care one unit (character or frame) of serial data * * note: * high except in continuous transmitting or receiving figure 13.14 data format in synchronous communication in synchronous serial communication, each data bit is placed on the communication line from one falling edge of the serial clock to the next. data is guaranteed valid at the rise of the serial clock. in each character, the serial data bits are transmitted in order from lsb (first) to msb (last). after output of the msb, the communication line remains in the state of the msb. in synchronous mode the sci receives data by synchronizing with the rise of the serial clock. communication format the data length is fixed at 8 bits. no parity bit or multiprocessor bit can be added.
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 500 of 872 rej09b0325-0300 clock an internal clock generated by the on-chip baud rate generator or an external clock input from the sck pin can be selected by setting the c/ a bit in smr and the cke1 and cke0 bits in scr. see table 13.9. when the sci operates on an internal clock, it outputs the clock signal at the sck pin. eight clock pulses are output per transmitted or received character. when the sci operates on an internal clock, the serial clock outputs the clock signal at the sck pin. eight clock pulses are output per transmitted or received character. when the sci is not transmitting or receiving, the clock signal remains in the high state. however, when receiving only, overrun error may occur or the serial clock continues output until the re bit clears at 0. when transmitting or receiving in single characters, select the external clock. transmitting and receiving data sci initialization (synchronous mode): before transmitting or receiving, clear the te and re bits to 0 in scr, then initialize the sci as follows. when changing the communication mode or format, always clear the te and re bits to 0 before following the procedure given below. clearing the te bit to 0 sets the tdre flag to 1 and initializes tsr. clearing the re bit to 0, however, does not initialize the rdrf, per, fer, and ore flags and rdr, which retain their previous contents. figure 13.15 is a sample flowchart for initializing the sci.
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 501 of 872 rej09b0325-0300 clear te and re bits to 0 in scr 1 bit interval elapsed? no ye s 1. 2. 3. 4. select the clock source in scr. clear the rie, tie, teie, mpie, te, and re bits to 0. select the communication format in smr. write the value corresponding to the bit rate in brr. this step is not necessary when an external clock is used. 1 2 set rie, tie, teie, mpie, cke1, and cke0 bits in scr (leaving te and re bits cleared to 0) 3 set te or re to 1 in scr set rie, tie, teie, and mpie bits as necessary 4 wait wait for at least the interval required to transmit or receive one bit, then set the te or re bit to 1 in scr. also set the rie, tie, teie, and mpie bits as necessary. setting the te or re bit enables the sci to use the txd or rxd pin. start of initialization set value in brr select communication format in smr note: in simultaneous transmitting and receiving, the te and re bits should be cleared to 0 or set to 1 simultaneously. start transmitting or receiving figure 13.15 sample flowchart for sci initialization
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 502 of 872 rej09b0325-0300 transmitting serial data (synchronous mode): figure 13.16 shows a sample flowchart for transmitting serial data and indicates the procedure to follow. start transmitting read tdre flag in ssr tdre = 1? write transmit data in tdr and clear tdre flag to 0 in ssr end 1 2 3 no yes no yes sci initialization: the transmit data output function of the txd pin is selected automatically. sci status check and transmit data write: read ssr, check that the tdre flag is 1, then write transmit data in tdr and clear the tdre flag to 0. read tend flag in ssr no yes 1. 2. 3. initialize clear te bit to 0 in scr to continue transmitting serial data: after checking that the tdre flag is 1, indicating that data can be written, write data in tdr, then clear the tdre flag to 0. when the dmac is activated by a transmit- data-empty interrupt request (txi) to write data in tdr, the tdre flag is checked and cleared automatically. all data transmitted? tend = 1? figure 13.16 sample flowchart for serial transmitting
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 503 of 872 rej09b0325-0300 in transmitting serial data, the sci operates as follows. 1. the sci monitors the tdre flag in ssr. when the tdre flag is cleared to 0 the sci recognizes that tdr contains new data, and loads this data from tdr into tsr. 2. after loading the data from tdr into tsr, the sci sets the tdre flag to 1 and starts transmitting. if the tie bit is set to 1 in scr, the sci requests a transmit-data-empty interrupt (txi) at this time. if clock output is selected, the sci outputs eight serial clock pulses. if an external clock source is selected, the sci outputs data in synchronization with the input clock. data is output from the txd pin in order from lsb (bit 0) to msb (bit 7). 3. the sci checks the tdre flag when it outputs the msb (bit 7). if the tdre flag is 0, the sci loads data from tdr into tsr and begins serial transmission of the next frame. if the tdre flag is 1, the sci sets the tend flag to 1 in ssr, and after transmitting the msb, holds the txd pin in the msb state. if the teie bit in scr is set to 1, a transmit-end interrupt (tei) is requested at this time. 4. after the end of serial transmission, the sck pin is held in a constant state. figure 13.17 shows an example of sci transmit operation. transmit direction serial clock serial data tdre tend bit 0 bit 1 bit 7 bit 0 bit 1 bit 6 bit 7 txi interrupt handler writes data in tdr and clears tdre flag to 0 txi request tei request 1 frame txi request figure 13.17 example of sci transmit operation
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 504 of 872 rej09b0325-0300 receiving serial data: figure 13.18 shows a sample flowchart for receiving serial data and indicates the procedure to follow. when switching from asynchronous mode to synchronous mode, make sure that the orer, per, and fer flags are cleared to 0. if the fer or per flag is set to 1 the rdrf flag will not be set and both transmitting and receiving will be disabled. start receiving read rdrf flag in ssr read receive data from rdr, and clear rdrf flag to 0 in ssr read orer flag in ssr clear re bit to 0 in scr end error handling continued on next page 1 4 5 no yes yes no yes 3 1. 2, 3. 4. 5. sci initialization: the receive data function of the rxd pin is selected automatically. receive error handling: if a receive error occurs, read the orer flag in ssr, then after executing the necessary error handling, clear the orer flag to 0. neither transmitting nor receiving can resume while the orer flag remains set to 1. sci status check and receive data read: read ssr, check that the rdrf flag is set to 1, then read receive data from rdr and clear the rdrf flag to 0. notification that the rdrf flag has changed from 0 to 1 can also be given by the rxi interrupt. to continue receiving serial data: check the rdrf flag, read rdr, and clear the rdrf flag to 0 before the msb (bit 7) of the current frame is received. if the dmac is activated by a receive-data-full interrupt request (rxi) to read rdr, the rdrf flag is cleared automatically. initialize no rdrf = 1? orer = 1? finished receiving? 2 figure 13.18 sample flowchart for serial receiving (1)
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 505 of 872 rej09b0325-0300 3 end error handling overrun error handling clear orer flag to 0 in ssr figure 13.18 sample flowchart for serial receiving (2) in receiving, the sci operates as follows. 1. the sci synchronizes with serial clock input or output and initializes internally. 2. receive data is stored in rsr in order from lsb to msb. after receiving the data, the sci checks that the rdrf flag is 0 so that receive data can be transferred from rsr to rdr. if this check passes, the rdrf flag is set to 1 and the received data is stored in rdr. if the check does not pass (receive error), the sci operates as indicated in table 13.11. 3. after setting the rdrf flag to 1, if the rie bit is set to 1 in scr, the sci requests a receive- data-full interrupt (rxi). if the orer flag is set to 1 and the rie bit in scr is also set to 1, the sci requests a receive-error interrupt (eri). figure 13.19 shows an example of sci receive operation.
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 506 of 872 rej09b0325-0300 serial clock serial data bit 7 bit 0 bit 7 bit 0 bit 1 bit 6 bit 7 rxi request receive direction rdrf orer rxi interrupt handler reads data in rdr and clears rdrf flag to 0 overrun error, eri request 1 frame rxi request figure 13.19 example of sci receive operation transmitting and receiving serial data simultaneously (synchronous mode): figure 13.20 shows a sample flowchart for transmitting and receiving serial data simultaneously and indicates the procedure to follow.
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 507 of 872 rej09b0325-0300 no ye s no ye s ye s no ye s no initialize start transmitting and receiving read tdre flag in ssr tdre = 1? write transmit data in tdr and clear tdre flag to 0 in ssr rdrf = 1? read rdrf flag in ssr read receive data from rdr and clear rdrf flag to 0 in ssr read orer flag in ssr orer = 1? end of transmitting and receiving? 1 2 5 3 1. 2. 3. 4. 5. sci initialization: the transmit data output function of the txd pin and receive data input function of the rxd pin are selected, enabling simultaneous transmitting and receiving. sci status check and transmit data write: read ssr, check that the tdre flag is 1, then write transmit data in tdr and clear the tdre flag to 0. error handling note: when switching from transmitting or receiving to simultaneous transmitting and receiving, clear both the te bit and the re bit to 0, then set both bits to 1. clear te and re bits to 0 in scr end notification that the tdre flag has changed from 0 to 1 can also be given by the txi interrupt. receive error handling: if a receive error occurs, read the orer flag in ssr, then after executing the neces- sary error handling, clear the orer flag to 0. neither transmitting nor receiving can resume while the orer flag remains set to 1. sci status check and receive data read: read ssr, check that the rdrf flag is 1, then read receive data from rdr and clear the rdrf flag to 0. notification that the rdrf flag has changed from 0 to 1 can also be given by the rxi interrupt. to continue transmitting and receiving serial data: check the rdrf flag, read rdr, and clear the rdrf flag to 0 before the msb (bit 7) of the current frame is received. also check that the tdre flag is set to 1, indicat- ing that data can be written, write data in tdr, then clear the tdre flag to 0 before the msb (bit 7) of the current frame is transmitted. when the dmac is activated by a transmit-data-empty interrupt request (txi) to write data in tdr, the tdre flag is checked and cleared automatically. when the dmac is activated by a receive- data-full interrupt request (rxi) to read rdr, the rdrf flag is cleared automatically. 4 figure 13.20 sample flowchart for serial transmitting
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 508 of 872 rej09b0325-0300 13.4 sci interrupts the sci has four interrupt request sources: tei (transmit-end interrupt), eri (receive-error interrupt), rxi (receive-data-full interrupt), and txi (transmit-data-empty interrupt). table 13.12 lists the interrupt sources and indicates their priority. these interrupts can be enabled and disabled by the tie, teie, and rie bits in scr. each interrupt request is sent separately to the interrupt controller. the txi interrupt is requested when the tdre flag is set to 1 in ssr. the tei interrupt is requested when the tend flag is set to 1 in ssr. the txi interrupt request can activate the dmac to transfer data. data transfer by the dmac automatically clears the tdre flag to 0. the tei interrupt request cannot activate the dmac. the rxi interrupt is requested when the rdrf flag is set to 1 in ssr. the eri interrupt is requested when the orer, per, or fer flag is set to 1 in ssr. the rxi interrupt request can activate the dmac to transfer data. data transfer by the dmac automatically clears the rdrf flag to 0. the eri interrupt request cannot activate the dmac. the dmac can be activated by interrupts from sci channel 0. table 13.12 sci interrupt sources interrupt description priority eri receive error (orer, fer, or per) high rxi receive data register full (rdrf) txi transmit data register empty (tdre) tei transmit end (tend) low
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 509 of 872 rej09b0325-0300 13.5 usage notes note the following points when using the sci. tdr write and tdre flag the tdre flag in ssr is a status flag indicating the loading of transmit data from tdr into tsr. the sci sets the tdre flag to 1 when it transfers data from tdr to tsr. data can be written into tdr regardless of the state of the tdre flag. if new data is written in tdr when the tdre flag is 0, the old data stored in tdr will be lost because this data has not yet been transferred to tsr. before writing transmit data in tdr, be sure to check that the tdre flag is set to 1. simultaneous multiple receive errors table 13.13 indicates the state of ssr status flags when multiple receive errors occur simultaneously. when an overrun error occurs the rsr contents are not transferred to rdr, so receive data is lost. table 13.13 ssr status flags and transfer of receive data ssr status flags rdrf orer fer per receive data transfer rsr rdr receive errors 1100 overrun error 0010o framing error 0001o parity error 1110 overrun error + framing error 1101 overrun error + parity error 0011o framing error + parity error 1111 overrun error + framing error + parity error legend: o: receive data is transferred from rsr to rdr. : receive data is not transferred from rsr to rdr.
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 510 of 872 rej09b0325-0300 break detection and processing break signals can be detected by reading the rxd pin directly when a framing error (fer) is detected. in the break state the input from the rxd pin consists of all 0s, so the fer flag is set and the parity error flag (per) may also be set. in the break state the sci receiver continues to operate, so if the fer flag is cleared to 0 it will be set to 1 again. sending a break signal when the te bit is cleared to 0 the txd pin becomes an i/o port, the level and direction (input or output) of which are determined by dr and ddr bits. this feature can be used to send a break signal. after the serial transmitter is initialized, the dr value substitutes for the mark state until the te bit is set to 1 (the txd pin function is not selected until the te bit is set to 1). the ddr and dr bits should therefore both be set to 1 beforehand. to send a break signal during serial transmission, clear the dr bit to 0, then clear the te bit to 0. when the te bit is cleared to 0 the transmitter is initialized, regardless of its current state, so the txd pin becomes an output port outputting the value 0. receive error flags and transmitter operation (synchronous mode only) when a receive error flag (orer, per, or fer) is set to 1 the sci will not start transmitting, even if the tdre flag is cleared to 0. be sure to clear the receive error flags to 0 when starting to transmit. note that clearing the re bit to 0 does not clear the receive error flags to 0. receive data sampling timing in asynchronous mode and receive margin in asynchronous mode the sci operates on a base clock with 16 times the bit rate frequency. in receiving, the sci synchronizes internally with the fall of the start bit, which it samples on the base clock. receive data is latched at the rising edge of the eighth base clock pulse. see figure 13.21.
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 511 of 872 rej09b0325-0300 internal base clock receive data (rxd) synchronization sampling timing data sampling timing 0 7 15 0 7 15 0 d 0 d 1 8 clocks 16 clocks start bit figure 13.21 receive data sampling timing in asynchronous mode the receive margin in asynchronous mode can therefore be expressed as in equation (1). m = (0.5 ? 1 2n d ? 0.5 n ) ? (l ? 0.5) f ? (1 + f) 100% ................... (1) m: receive margin (%) n: ratio of clock frequency to bit rate (n = 16) d: clock duty cycle (d = 0 to 1.0) l: frame length (l = 9 to 12) f: absolute deviation of clock frequency from equation (1), if f = 0 and d = 0.5 the receive margin is 46.875%, as given by equation (2). d = 0.5, f = 0 m = {0.5 ? 1/(2 16)} 100% = 46.875% ............................................................................................. (2) this is a theoretical value. a reasonable margin to allow in system designs is 20% to 30%. restrictions on usage of dmac to have the dmac read rdr, be sure to select the sci receive-data-full interrupt (rxi) as the activation source with bits dts2 to dts0 in dtcr.
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 512 of 872 rej09b0325-0300 restrictions on usage of the serial clock when transmitting data using an external clock as the serial clock, an interval of at least 5 states is necessary between clearing the tdre bit in ssr and the start (falling edge) of the first transmit clock pulse corresponding to each frame (see figure 13.22). this condition is also needed for continuous transmission. if it is not fulfilled, operational error will occur. sck tdre txd t * t * continuous transmission x0 x1 x2 x3 y0 y1 y2 y3 x4 x5 x6 x7 note: * ensure that t 5 states. figure 13.22 serial clock transmission (example)
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 513 of 872 rej09b0325-0300 switching sck pin to port output pin in synchronous mode when the sck pin is used as the serial clock output in synchronous mode, and is then switched to its output port function at the end of transmission, a low level may be output for one half-cycle. half-cycle low-level output occurs when sck is switched to its port function with the following settings when ddr = 1, dr = 1, c/ a = 1, cke1 = 0, cke0 = 0, and te = 1. 1. end of serial data transmission 2. te bit = 0 3. c/ a bit = 0 ... switchover to port output 4. occurrence of low-level output (see figure 13.23) sck/port data te c/ a cke1 cke0 bit 7 bit 6 1. end of transmission 4. low-level output 3. c/ a = 0 2. te = 0 half-cycle low-level output figure 13.23 operation when switching from sck pin to port pin
section 13 serial communication interface rev. 3.00 sep 27, 2006 page 514 of 872 rej09b0325-0300 sample procedure for preventing low-level output as this sample procedure temporarily places the sck pin in the input state, the sck/port pin should be pulled up beforehand with an external circuit. with ddr = 1, dr = 1, c/ a = 1, cke1 = 0, cke0 = 0, and te = 1, make the following settings in the order shown. 1. end of serial data transmission 2. te bit = 0 3. cke1 bit = 1 4. c/ a bit = 0 ... switchover to port output 5. cke1 bit = 0 sck/port data te c/ a cke1 cke0 bit 7 bit 6 1. end of transmission 3. cke1 = 1 5. cke1 = 0 4. c/ a = 0 2. te = 0 high-level output figure 13.24 operation when switching from sck pin function to port pin function (example of preventing low-level output)
section 14 smart card interface rev. 3.00 sep 27, 2006 page 515 of 872 rej09b0325-0300 section 14 smart card interface 14.1 overview as an extension of its serial communication interface functions, sci0 supports a smart card (ic card) interface conforming to the iso/iec7816-3 (identification card) standard. switchover between normal serial communication and the smart card interface is controlled by a register setting. 14.1.1 features features of the smart-card interface supported by the h8/3048b group are listed below. ? asynchronous communication ? data length: 8 bits ? parity bits generated and checked ? error signal output in receive mode (parity error) ? error signal detect and automatic data retransmit in transmit mode ? supports both direct convention and inverse convention ? built-in baud rate generator with selectable bit rates ? three types of interrupts transmit-data-empty, receive-data-full, and receive-error interrupts are requested independently. the transmit-data-empty and receive-data-full interrupts can activate the dma controller (dmac) to transfer data.
section 14 smart card interface rev. 3.00 sep 27, 2006 page 516 of 872 rej09b0325-0300 14.1.2 block diagram figure 14.1 shows a block diagram of the smart card interface. module data bus internal data bus brr scmr baud rate generator transmit/receive control rdr tsr rsr bus interface ssr scr smr tdr legend: scmr: rsr: rdr: tsr: tdr: smr: scr: ssr: brr: smart card mode register receive shift register receive data register transmit shift register transmit data register serial mode register serial control register serial status register bit rate register /4 /16 /64 txi clock parity generate parity check rxd 0 txd 0 sck 0 rxi eri figure 14.1 smart card interface block diagram
section 14 smart card interface rev. 3.00 sep 27, 2006 page 517 of 872 rej09b0325-0300 14.1.3 input/output pins table 14.1 lists the smart card interface pins. table 14.1 smart card interface pins name abbreviation i/o function serial clock pin sck 0 output clock output receive data pin rxd 0 input receive data input transmit data pin txd 0 output transmit data output 14.1.4 register configuration the smart card interface has the internal registers listed in table 14.2. brr, tdr, and rdr have their normal serial communication interface functions, as described in section 13, serial communication interface. table 14.2 registers address * 1 name abbreviation r/w initial value h'ffb0 serial mode register smr r/w h'00 h'ffb1 bit rate register brr r/w h'ff h'ffb2 serial control register scr r/w h'00 h'ffb3 transmit data register tdr r/w h'ff h'ffb4 serial status register ssr r/(w) * 2 f'84 h'ffb5 receive data register rdr r h'00 h'ffb6 smart card mode register scmr r/w h'f2 notes: 1. lower 16 bits of the address. 2. only 0 can be written, to clear flags.
section 14 smart card interface rev. 3.00 sep 27, 2006 page 518 of 872 rej09b0325-0300 14.2 register descriptions this section describes the new or modified registers and bit functions in the smart card interface. 14.2.1 smart card mode register (scmr) scmr is an 8-bit readable/writable register that selects smart card interface functions. bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 sdir 0 r/w 0 smif 0 r/w 2 sinv 0 r/w 1 ? 1 ? reserved bits smart card data transfer direction selects the serial/parallel conversion format smart card data invert inverts data logic levels smart card interface mode select enables or disables the smart card interface function reserved bits scmr is initialized to h'f2 by a reset and in standby mode. bits 7 to 4?reserved: read-only bits, always read as 1. bit 3?smart card data transfer direction (sdir) : selects the serial/parallel conversion format. bit 3: sdir description 0 tdr contents are transmitted lsb-first (initial value) received data is stored lsb-first in rdr 1 tdr contents are transmitted msb-first received data is stored msb-first in rdr
section 14 smart card interface rev. 3.00 sep 27, 2006 page 519 of 872 rej09b0325-0300 bit 2?smart card data inverter (sinv): inverts data logic levels. this function is used in combination with bit 3 to communicate with inverse-convention cards. sinv does not affect the logic level of the parity bit. for parity settings, see section 14.3.4, register settings. bit 2: sinv description 0 unmodified tdr contents are transmitted (initial value) received data is stored unmodified in rdr 1 inverted tdr contents are transmitted received data is inverted before storage in rdr bit 1?reserved: read-only bit, always read as 1. bit 0?smart card interface mode select (smif): enables the smart card interface function. bit 0: smif description 0 smart card interface function is disabled (initial value) 1 smart card interface function is enabled 14.2.2 serial status register (ssr) the function of ssr bit 4 is modified in the smart card interface. this change also causes a modification to the setting conditions for bit 2 (tend). bit initial value read/write note: * only 0 can be written, to clear the flag. 7 tdre 1 r/(w) * 6 rdrf 0 r/(w) * 5 orer 0 r/(w) * 4 ers 0 r/(w) * 3 per 0 r/(w) * 0 mpbt 0 r/w 2 tend 1 r 1 mpb 0 r error signal status (ers) status flag indicating that an error signal has been received transmit end status flag indicating end of transmission
section 14 smart card interface rev. 3.00 sep 27, 2006 page 520 of 872 rej09b0325-0300 bits 7 to 5: these bits operate as in normal serial communication. for details see section 13, serial communication interface. bit 4?error signal status (ers): in smart card interface mode, this flag indicates the status of the error signal sent from the receiving device to the transmitting device. the smart card interface does not detect framing errors. bit 4: ers description 0 indicates normal data transmission, with no error signal returned (initial value) [clearing conditions] the chip is reset or enters standby mode. software reads ers while it is set to 1, then writes 0. 1 indicates that the receiving device sent an error signal reporting a parity error [setting condition] a low error signal was sampled. note: clearing the te bit to 0 in scr does not affect the ers flag, which retains its previous value. bits 3 to 0: these bits operate as in normal serial communication. for details see section 13, serial communication interface. the setting conditions for transmit end (tend, bit 2), however, are modified as follows. bit 2: tend description 0 transmission is in progress [clearing conditions] software reads tdre while it is set to 1, then writes 0 in the tdre flag. the dmac writes data in tdr. 1 end of transmission (initial value) [setting conditions] the chip is reset or enters standby mode. the te bit and fer/ers bit are both cleared to 0 in scr. tdre is 1 and fer/ers is 0 at a time 2.5 etu after the last bit of a 1-byte serial character is transmitted (normal transmission) note: an etu (elementary time unit) is the time needed to transmit one bit.
section 14 smart card interface rev. 3.00 sep 27, 2006 page 521 of 872 rej09b0325-0300 14.2.3 serial mode register (smr) bit 7 of smr has a different function in smart card interface mode. the related serial control register (scr) changes from bit 1 to bit 0. however, this function does not exist in the flash memory version. bit initial value read/write 7 gm 0 r/w 6 chr 0 r/w 5 pe 0 r/w 4 o/e 0 r/w 3 stop 0 r/w 0 cks0 0 r/w 2 mp 0 r/w 1 cks1 0 r/w bit 7?gsm mode (gm): set at 0 when using the regular smart card interface. in gsm mode, set to 1. when transmission is complete, initially the tend flag set timing appears followed by clock output restriction mode. clock output restriction mode comprises serial control register bit 1 and bit 0. bit 7: gm description 0 using the regular smart card interface mode ? the tend flag is set 12.5 etu after the beginning of the start bit (initial value) ? clock output on/off control only 1 using the gsm mode smart card interface mode ? the tend flag is set 11.0 etu after the beginning of the start bit ? clock output on/off and fixed-high/fixed-low control (set by scr) bits 6 to 0?operate in the same way as for the normal sci. for details, see section 13.2.5, serial mode register (smr).
section 14 smart card interface rev. 3.00 sep 27, 2006 page 522 of 872 rej09b0325-0300 14.2.4 serial control register (scr) bits 1 and 0 have different functions in smart card interface mode. however, this function does not exist in the flash memory version. bit initial value read/write 7 tie 0 r/w 6 rie 0 r/w 5 te 0 r/w 4 re 0 r/w 3 mpie 0 r/w 0 cke0 0 r/w 2 teie 0 r/w 1 cke1 0 r/w bits 7 to 2?operate in the same way as for the normal sci. for details, see section 13.2.6, serial control register (scr). bits 1 and 0?clock enable (cke1, cke0): setting enable or disable for the sci clock selection and clock output from the sck pin. in smart card interface mode, it is possible to switch between enabling and disabling of the normal clock output, and specify a fixed high level or fixed low level for the clock output. smr scr bit 7: gm bit 1: cke1 bit 0: cke0 description 0 0 0 the internal clock/sck 0 pin functions as an i/o port (initial value) 0 0 1 the internal clock/sck 0 pin functions as the clock output 1 0 0 the internal clock/sck 0 pin is fixed at low-level output 1 0 1 the internal clock/sck 0 pin functions as the clock output 1 1 0 the internal clock/sck 0 pin is fixed at high-level output 1 1 1 the internal clock/sck 0 pin functions as the clock output
section 14 smart card interface rev. 3.00 sep 27, 2006 page 523 of 872 rej09b0325-0300 14.3 operation 14.3.1 overview the main features of the smart-card interface are as follows. ? one frame consists of eight data bits and a parity bit. ? in transmitting, a guard time of at least two elementary time units (2 etu) is provided between the end of the parity bit and the start of the next frame. (an elementary time unit is the time required to transmit one bit.) ? in receiving, if a parity error is detected, a low error signal is output for 1 etu, beginning 10.5 etu after the start bit. ? in transmitting, if an error signal is received, after at least 2 etu, the same data is automatically transmitted again. ? only asynchronous communication is supported. there is no synchronous communication function. 14.3.2 pin connections figure 14.2 shows a pin connection diagram for the smart card interface. in communication with a smart card, data is transmitted and received over the same signal line. the txd 0 and rxd 0 pins should both be connected to this line. the data transmission line should be pulled up to v cc through a resistor. if the smart card uses the clock generated by the smart card interface, connect the sck 0 output pin to the card?s clk input. if the card uses its own internal clock, this connection is unnecessary. the reset signal should be output from one of the h8/3048b group?s generic ports. in addition to these pin connections, power and ground connections will normally also be necessary.
section 14 smart card interface rev. 3.00 sep 27, 2006 page 524 of 872 rej09b0325-0300 h8/3048b group card-processing device smart card txd 0 rxd 0 sck 0 px (port) i/o clk rst data line v cc clock line reset line figure 14.2 smart card interface connection diagram note: a loop-back test can be performed by setting both re and te to 1 without connecting a smart card. 14.3.3 data format figure 14.3 shows the data format of the smart card interface. in receive mode, parity is checked once per frame. if a parity error is detected, an error signal is returned to the transmitting device to request retransmission. in transmit mode, the error signal is sampled and the same data is retransmitted if the error signal is low.
section 14 smart card interface rev. 3.00 sep 27, 2006 page 525 of 872 rej09b0325-0300 ds parity error d0 d1 d2 d3 output from transmitting device output from receiving device d4 d5 d6 d7 dp de ds no parity error d0 d1 d2 d3 output from transmitting device d4 d5 d6 d7 dp ds: d0 to d7: dp: de: legend: start bit data bits parity bit error signal figure 14.3 smart card interface data format the operating sequence is as follows. 1. when not in use, the data line is in the high-impedance state, and is pulled up to the high level through a resistor. 2. to start transmitting a frame of data, the transmitting device transmits a low start bit (ds), followed by eight data bits (d0 to d7) and a parity bit (dp). 3. next, in the smart card interface, the transmitting device returns the data line to the high- impedance state. the data line is pulled up to the high level through a resistor. 4. the receiving device performs a parity check. if there is no parity error, the receiving device waits to receive the next data. if a parity error is present, the receiving device outputs a low error signal (de) to request retransmission of the data. after outputting the error signal for a designated interval, the receiving device returns the signal line to the high-impedance state. the signal line is pulled back up to the high level through the pull-up resistor. 5. if the transmitting device does not receive an error signal, it proceeds to transmit the next data. if it receives an error signal, it returns to step 2 and transmits the same data again.
section 14 smart card interface rev. 3.00 sep 27, 2006 page 526 of 872 rej09b0325-0300 14.3.4 register settings table 14.3 shows a bit map of the registers used in the smart card interface. bits indicated as 0 or 1 should always be set to the indicated value. the settings of the other bits will be described in this section. table 14.3 register settings in smart card interface register address * 1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 smr h'ffb0 gm 0 1 o/ e 1 0 cks1 cks0 brr h'ffb1 brr7 brr6 brr5 brr4 brr3 brr2 brr1 brr0 scr h'ffb2 tie rie te re 0 0 cke1 * 2 cke0 tdr h'ffb3 tdr7 tdr6 tdr5 tdr4 tdr3 tdr2 tdr1 tdr0 ssr h'ffb4 tdre rdrf orer ers per tend 0 0 rdr h'ffb5 rdr7 rdr6 rdr5 rdr4 rdr3 rdr2 rdr1 rdr0 scmr h'ffb6 ? ? ? ? sdir sinv ? smif legend: ?: unused bit. notes: 1. lower 16 bits of the address. 2. when the gm of the smr is set at 0, be sure the cke1 bit is 0. serial mode register (smr) settings: in regular smart card interface mode, set the gm bit at 0. in regular smart card mode, clear the gm bit to 0. in gsm mode, set the gm bit to 1. clear the o/ e bit to 0 if the smart card uses the direct convention. set the o/ e bit to 1 if the smart card uses the inverse convention. bits cks1 and cks0 select the clock source of the built-in baud rate generator. see section 14.3.5, clock. bit rate register (brr) settings: this register sets the bit rate. equations for calculating the setting are given in section 14.3.5, clock. serial control register (scr): the tie, rie, te, and re bits have their normal serial communication functions. for details, see section 13, serial communication interface. the cke1 and cke0 bits select clock output. when the gm bit of the smr is cleared to 0, to disable clock output, clear this bit to 00. to enable clock output, set this bit to 01. when the gm bit of the smr is set to 1, clock output is enabled. clock output is fixed at high or low. smart card mode register (scmr): if the smart card follows the direct convention, clear the sdir and sinv bits to 0. if the smart card follows the indirect convention, set the sdir and sinv bits to 1. to use the smart card interface, set the smif bit to 1.
section 14 smart card interface rev. 3.00 sep 27, 2006 page 527 of 872 rej09b0325-0300 the register settings and examples of starting character waveforms are shown below for two smart cards, one following the direct convention and one the inverse convention. ? direct convention (sdir = sinv = o/ e = 0) ds d0 d1 d2 d3 d4 d5 d6 d7 dp azzazzzaaz (z) (z) state in the direct convention, state z corresponds to logic level 1, and state a to logic level 0. characters are transmitted and received lsb-first. in the example above the first character data is h'3b. the parity bit is 1, following the even parity rule designated for smart cards. ? inverse convention (sdir = sinv = o/ e = 1) ds d7 d6 d5 d4 d3 d2 d1 d0 dp azzaaaaaaz (z) (z) state in the inverse convention, state a corresponds to the logic level 1, and state z to the logic level 0. characters are transmitted and received msb-first. in the example above the first character data is h'3f. following the even parity rule designated for smart cards, the parity bit logic level is 0, corresponding to state z. in the h8/3048b group, the sinv bit inverts only the data bits d7 to d0. the parity bit is not inverted, so the o/ e bit in smr must be set to odd parity mode. this applies in both transmitting and receiving.
section 14 smart card interface rev. 3.00 sep 27, 2006 page 528 of 872 rej09b0325-0300 14.3.5 clock as its serial communication clock, the smart card interface can use only the internal clock generated by the on-chip baud rate generator. the bit rate can be selected by setting the bit rate register (brr) and bits cks1 and cks0 in the serial mode register (smr). the bit rate can be calculated from the equation given below. table 14.5 lists some examples of bit rate settings. if bit cke0 is set to 1, a clock signal with a frequency equal to 372 times the bit rate is output from the sck 0 pin. b = 1488 2 2n ? 1 (n + 1) 10 6 where, n: brr setting (0 n 255) b: bit rate (bits/s) : system clock frequency (mhz) * n: see table 14.4 table 14.4 n-values of cks1 and cks0 settings n cks1 cks0 000 101 210 311 note: * if the gear function is used to divide the system clock frequency, use the divided frequency to calculate the bit rate. the equation above applies directly to 1/1 frequency division. table 14.5 bit rates (bits/s) for different brr settings (when n = 0) (mhz) n 7.1424 10.00 10.7136 13.00 14.2848 16.00 18.00 20.00 25.00 0 9600.0 13440.9 14400.0 17473.1 19200.0 21505.4 24193.5 26881.7 33602.2 1 4800.0 6720.4 7200.0 8736.6 9600.0 10752.7 12096.8 13440.9 16801.1 2 3200.0 4480.3 4800.0 5824.4 6400.0 7168.5 8064.5 8960.6 11200.7 note: bit rates are rounded off to one decimal place.
section 14 smart card interface rev. 3.00 sep 27, 2006 page 529 of 872 rej09b0325-0300 the following equation calculates the bit rate register (brr) setting from the system clock frequency and bit rate. n is an integer from 0 to 255, specifying the value with the smaller error. n = 1488 2 2n ? 1 b 10 6 ? 1 table 14.6 brr settings for typical bit rate (bits/s) (when n = 0) (mhz) 7.1424 10.00 10.7136 13.00 14.2848 16.00 18.00 20.00 25.00 bit/s n error n error n error n error n error n error n error n error n error 9600 0 0.00 1 30.00 1 25.00 1 8.99 1 0.00 1 12.01 2 15.99 2 6.66 3 12.49 table 14.7 maximum bit rates for various frequencies (smart card interface) (mhz) maximum bit rate (bits/s) n n 7.1424 9600 0 0 10.00 13441 0 0 10.7136 14400 0 0 13.00 17473 0 0 14.2848 19200 0 0 16.00 21505 0 0 18.00 24194 0 0 20.00 26882 0 0 25.00 33602 0 0 the bit rate error is calculated from the following equation. error (%) = 1488 2 2n ? 1 b (n + 1) 10 6 ? 1 100
section 14 smart card interface rev. 3.00 sep 27, 2006 page 530 of 872 rej09b0325-0300 14.3.6 transmitting and receiving data initialization before transmitting or receiving data, initialize the smart card interface by the procedure below. initialization is also necessary when switching from transmit mode to receive mode or from receive mode to transmit mode. 1. clear the te and re bits to 0 in the serial control register (scr). 2. clear the ers, per, and orer error flags to 0 in the serial status register (ssr). 3. set the parity mode bit (o/ e ) and baud rate generator clock source select bits (cks1 and cks0) as required in the serial mode register (smr). at the same time, clear the c/ a , chr, and mp bits to 0, and set the stop and pe bits to 1. 4. set the smif, sdir, and sinv bits as required in the smart card mode register (scmr). when the smif bit is set to 1, the txd 0 and rxd 0 pins switch from their i/o port functions to their serial communication interface functions, and are placed in the high-impedance state. 5. set a value corresponding to the desired bit rate in the bit rate register ( brr). 6. set clock enable bit 0 (cke0) as required in the serial control register (scr). write 0 in the tie, rie, te, re, mpie, teie, and cke1 bits. if bit cke0 is set to 1, a serial clock will be output from the sck 0 pin. 7. wait for at least the interval required to transmit or receive one bit, then set the tie, rie, te, and re bits as necessary in scr. do not set te and re both to 1, except when performing a loop-back test.
section 14 smart card interface rev. 3.00 sep 27, 2006 page 531 of 872 rej09b0325-0300 transmitting serial data the transmitting procedure in smart card mode is different from the normal sci procedure, because of the need to sample the error signal and retransmit. figure 14.4 shows a flowchart for transmitting, and figure 14.5 shows the relation between a transmit operation and the internal registers. 1. initialize the smart card interface by the procedure given above in initialization. 2. check that the ers error flag is cleared to 0 in ssr. 3. check that the tend flag is set to 1 in ssr. repeat steps 2 and 3 until this check passes. 4. write transmit data in tdr and clear the tdre flag to 0. the data will be transmitted and the tend flag will be cleared to 0. 5. to continue transmitting data, return to step 2. 6. to terminate transmission, clear the te bit to 0. this procedure may include interrupt handling and dma transfer. if the tie bit is set to 1 to enable interrupt requests, when transmission is completed and the tend flag is set to 1, a transmit-data-empty interrupt (txi) is requested. if the rie bit is set to 1 to enable interrupt requests, when a transmit error occurs and the ers flag is set to 1, a transmit/receive-error interrupt (eri) is requested. the timing of tend flag setting depends on the gm bit in smr. the timing is shown in figure 14.6. if the txi interrupt activates the dmac, the number of bytes designated in the dmac can be transmitted automatically, including automatic retransmit. for details, see interrupt operations and data transfer by dmac in this section.
section 14 smart card interface rev. 3.00 sep 27, 2006 page 532 of 872 rej09b0325-0300 fer/ers = 0 ? tend = 1 ? fer/ers = 0 ? tend = 1 ? all data transmitted ? initialize write data in tdr and clear tdre flag to 0 in ssr clear te bit to 0 start error handling error handling start transmitting end no no no no no yes yes yes yes yes figure 14.4 transmit flowchart (example)
section 14 smart card interface rev. 3.00 sep 27, 2006 page 533 of 872 rej09b0325-0300 tdr tsr (shift register) (1) data write (2) transfer from tdr to tsr (3) serial data output data 1 data 1 data 1 data 1 ; data remains in tdr i/o signal line output in case of normal transmission: tend flag is set in case of transmit error: ers flag is set steps (2) and (3) above are repeated until the tend flag is set data 1 note: when the ers flag is set, it should be cleared until transfer of the last bit (d7 in lsb-first transmission, d0 in msb-first transmission) of the next transfer data to be transmitted has been completed. figure 14.5 relation between transmit operation and internal registers i/o data guard time when gm = 1 when gm = 0 txi (tend interrupt) ds da db dc dd de 12.5 etu 11.0 etu df dg dh dp de figure 14.6 tend flag occurrence timing
section 14 smart card interface rev. 3.00 sep 27, 2006 page 534 of 872 rej09b0325-0300 receiving serial data the receiving procedure in smart card mode is the same as the normal sci procedure. figure 14.7 shows a flowchart for receiving. 1. initialize the smart card interface by the procedure given in initialization at the beginning of this section. 2. check that the orer and per error flags are cleared to 0 in ssr. if either flag is set, carry out the necessary error handling, then clear both the orer and per flags to 0. 3. check that the rdrf flag is set to 1. repeat steps 2 and 3 until this check passes. 4. read receive data from rdr. 5. to continue receiving data, clear the rdrf flag to 0 and return to step 2. 6. to terminate receiving, clear the re bit to 0. orer = 0 and per = 0 ? rdrf = 1 ? all data received ? initialize read rdr and clear rdrf flag to 0 in ssr clear re bit to 0 start error handling start receiving no no no yes yes yes figure 14.7 receive flowchart (example)
section 14 smart card interface rev. 3.00 sep 27, 2006 page 535 of 872 rej09b0325-0300 this procedure may include interrupt handling and dma transfer. if the rie bit is set to 1 to enable interrupt requests, when receiving is completed and the rdrf flag is set to 1, a receive-data-full interrupt (rxi) is requested. if a receive error occurs, either the orer or per flag is set to 1 and a transmit/receive-error interrupt (eri) is requested. if the rxi interrupt activates the dmac, the number of bytes designated in the dmac will be transferred, skipping receive data in which an error occurred. for details, see interrupt operations and data transfer by dmac below. when a parity error occurs and per is set to 1, the receive data is transferred to rdr, so the erroneous data can be read. switching modes to switch from receive mode to transmit mode, check that receiving operations have completed, then initialize the smart card interface, clearing re to 0 and setting te to 1. completion of receive operations is indicated by the rdrf, per, or orer flag. to switch from transmit mode to receive mode, check that transmitting operations have completed, then initialize the smart card interface, clearing te to 0 and setting re to 1. completion of transmit operations can be verified from the tend flag. fixing clock output when the gm bit of the smr is set to 1, clock output is fixed by cke1 and cke0 of scr. in this case, the clock pulse can be set at minimum value. figure 14.8 shows clock output fixed timing: cke0 is restricted with gm = 1 and cke1 = 1. scr write (cke0 = 1) scr write (cke0 = 0) sck specified pulse width specified pulse width cke1 value figure 14.8 clock output fixed timing
section 14 smart card interface rev. 3.00 sep 27, 2006 page 536 of 872 rej09b0325-0300 interrupt operations the smart card interface has three interrupt sources: transmit-data-empty (txi), transmit/receive- error (eri), and receive-data-full (rxi). the transmit-end interrupt request (tei) is not available in smart card mode. a txi interrupt is requested when the tend flag is set to 1 in ssr. an rxi interrupt is requested when the rdrf flag is set to 1 in ssr. an eri interrupt is requested when the orer, per, or ers flag is set to 1 in ssr. these relationships are shown in table 14.8. table 14.8 smart card mode operating states and interrupt sources operating state flag mask bit interrupt source dmac activation transmit mode normal operation tend tie txi available error ers rie eri not available receive mode normal operation rdrf rie rxi available error per, orer rie eri not available data transfer by dmac the dmac can be used to transmit and receive in smart card mode, as in normal sci operations. in transmit mode, when the tend flag is set to 1 in ssr, the tdre flag is set simultaneously, generating a txi interrupt. if txi is designated in advance as a dmac activation source, the dmac will be activated by the txi request and will transfer the next transmit data. this data transfer by the dmac automatically clears the tdre and tend flags to 0. when an error occurs, the sci automatically retransmits the same data, keeping tend cleared to 0 so that the dmac is not activated. the sci and dmac will therefore automatically transmit the designated number of bytes, including retransmission when an error occurs. when an error occurs the ers flag is not cleared automatically, so the rie bit should be set to 1 to enable the error to generate an eri request, and the eri interrupt handler should clear ers. when using the dmac to transmit or receive, first set up and enable the dmac, then make sci settings. dmac settings are described in section 8, dma controller. in receive operations, when the rdrf flag is set to 1 in ssr, an rxi interrupt is requested. if rxi is designated in advance as a dmac activation source, the dmac will be activated by the rxi request and will transfer the received data. this data transfer by the dmac automatically clears the rdrf flag to 0. when an error occurs, the rdrf flag is not set and an error flag is set instead. the dmac is not activated. the eri interrupt request is directed to the cpu. the eri interrupt handler should clear the error flags.
section 14 smart card interface rev. 3.00 sep 27, 2006 page 537 of 872 rej09b0325-0300 examples of operation in gsm mode when switching between smart card interface mode and software standby mode, use the following procedures to maintain the clock duty cycle. ? switching from smart card interface mode to software standby mode 1. set the p9 4 data register (dr) and data direction register (ddr) to the values for the fixed output state in software standby mode. 2. write 0 to the te and re bits in the serial control register (scr) to stop transmit/receive operations. at the same time, set the cke1 bit to the value for the fixed output state in software standby mode. 3. write 0 to the cke0 bit in scr to stop the clock. 4. wait for one serial clock cycle. during this period, the duty cycle is preserved and clock output is fixed at the specified level. 5. write h'00 to the serial mode register (smr) and smart card mode register (scmr). 6. make the transition to the software standby state. ? returning from software standby mode to smart card interface mode 1. clear the software standby state. 2. set the cke1 bit in scr to the value for the fixed output state at the start of software standby (the current p9 4 pin state). 3. set smart card interface mode and output the clock. clock signal generation is started with the normal duty cycle. (1)(2)(3) (1) (2)(3) (4) (5)(6) normal operation normal operation software standby mode figure 14.9 procedure for stopping and restarting the clock
section 14 smart card interface rev. 3.00 sep 27, 2006 page 538 of 872 rej09b0325-0300 use the following procedure to secure the clock duty cycle after powering on. 1. the initial state is port input and high impedance. use pull-up or pull-down resistors to fix the potential. 2. fix at the output specified by the cke1 bit in scr. 3. set smr and scmr, and switch to smart card interface mode operation. 4. set the cke0 bit in scr to 1 to start clock output. 14.4 usage notes when using the sci as a smart card interface, note the following points. receive data sampling timing in smart card mode and receive margin in smart card mode the sci operates on a base clock with 372 times the bit rate frequency. in receiving, the sci synchronizes internally with the fall of the start bit, which it samples on the base clock. receive data is latched at the rising edge of the 186th base clock pulse. see figure 14.10. 372 clocks 186 clocks 185 185 internal base clock receive data (rxd) synchronization sampling timing data sampling timing 0 d1 d0 371 371 00 start bit figure 14.10 receive data sampling timing in smart card mode
section 14 smart card interface rev. 3.00 sep 27, 2006 page 539 of 872 rej09b0325-0300 the receive margin can therefore be expressed as follows. receive margin in smart card mode: m = 0.5 ? 1 2n d ? 0.5 n ? (l ? 0.5) f ? (1 + f) 100% m: receive margin (%) n: ratio of clock frequency to bit rate (n = 372) d: clock duty cycle (d = 0 to 1.0) l: frame length (l = 10) f: absolute deviation of clock frequency from this equation, if f = 0 and d = 0.5 the receive margin is as follows. d = 0.5, f = 0 m = {0.5 ? 1/(2 372)} 100% = 49.866% retransmission retransmission is described below for the separate cases of transmit mode and receive mode. ? retransmission when sci is in receive mode (see figure 14.11) (1) the sci checks the received parity bit. if it detects an error, it automatically sets the per flag to 1. if the rie bit in scr is set to the enable state, an eri interrupt is requested. the per flag should be cleared to 0 in ssr before the next parity bit sampling timing. (2) the rdrf bit in ssr is not set to 1 for the error frame. (3) if an error is not detected when the parity bit is checked, the per flag is not set in ssr. (4) if an error is not detected when the parity bit is checked, receiving operations are assumed to have ended normally, and the rdrf bit is automatically set to 1 in ssr. if the rie bit in scr is set to the enable state, an rxi interrupt is requested. if rxi is enabled as a dma transfer activation source, the rdr contents can be read automatically. when the dmac reads the rdr data, it automatically clears rdrf to 0. (5) when a normal frame is received, at the error signal transmit timing, the data pin is held in the high-impedance state.
section 14 smart card interface rev. 3.00 sep 27, 2006 page 540 of 872 rej09b0325-0300 ds d0 d1 d2 d3 d4 d5 d6 d7 dp de ds d0 d1 d2 d3 d4 d5 d6 d7 dp ds (de) d0 d1 d2 d3 d4 frame n rdrf (2) (4) (1) (3) per retransmitted frame frame n + 1 figure 14.11 retransmission in sci receive mode ? retransmission when sci is in transmit mode (see figure 14.12) (6) after transmitting one frame, if the receiving device returns an error signal, the sci sets the ers flag to 1 in ssr. if the rie bit in scr is set to the enable state, an eri interrupt is requested. the ers flag should be cleared to 0 in ssr before the next parity bit sampling timing. (7) the tend bit in ssr is not set for the frame in which the error signal was received, indicating an error. (8) if no error signal is returned from the receiving device, the ers flag is not set in ssr. (9) if no error signal is returned from the receiving device, transmission of the frame, including retransmission, is assumed to be complete, and the tend bit is set to 1 in ssr. if the tie bit in scr is set to the enable state, a txi interrupt is requested. if txi is enabled as a dma transfer activation source, the next data can be written in tdr automatically. when the dmac writes data in tdr, it automatically clears the tdre bit to 0. ds d0 d1 d2 d3 d4 d5 d6 d7 dp de ds d0 d1 d2 d3 d4 d5 d6 d7 dp ds (de) d0 d1 d2 d3 d4 frame n (9) (7) transfer from tdr to tsr transfer from tdr to tsr transfer from tdr to tsr tdre tend ers (6) (8) retransmitted frame frame n + 1 figure 14.12 retransmission in sci transmit mode
section 15 a/d converter rev. 3.00 sep 27, 2006 page 541 of 872 rej09b0325-0300 section 15 a/d converter 15.1 overview the h8/3048b group includes a 10-bit successive-approximations a/d converter with a selection of up to eight analog input channels. when the a/d converter is not used, it can be halted independently to conserve power. for details see section 20.6, module standby function. 15.1.1 features a/d converter features are listed below. ? 10-bit resolution ? eight input channels ? selectable analog conversion voltage range the analog voltage conversion range can be programmed by input of an analog reference voltage at the v ref pin. ? high-speed conversion conversion time: minimum 5.36 s per channel (with 25-mhz system clock) ? two conversion modes single mode: a/d conversion of one channel scan mode: continuous conversion on one to four channels ? four 16-bit data registers a/d conversion results are transferred for storage into data registers corresponding to the channels. ? sample-and-hold function ? a/d conversion can be externally triggered ? a/d interrupt requested at end of conversion at the end of a/d conversion, an a/d end interrupt (adi) can be requested.
section 15 a/d converter rev. 3.00 sep 27, 2006 page 542 of 872 rej09b0325-0300 15.1.2 block diagram figure 15.1 shows a block diagram of the a/d converter. module data bus bus interface internal data bus addra addrb addrc addrd adcsr adcr successive- approximations register 10-bit d/a av v av cc ref ss analog multi- plexer an an an an an an an an 0 1 2 3 4 5 6 7 sample-and- hold circuit comparator + ? control circuit adtrg /8 /16 adi legend: adcr: adcsr: addra: addrb: addrc: addrd: a/d control register a/d control/status register a/d data register a a/d data register b a/d data register c a/d data register d figure 15.1 a/d converter block diagram
section 15 a/d converter rev. 3.00 sep 27, 2006 page 543 of 872 rej09b0325-0300 15.1.3 input pins table 15.1 summarizes the a/d converter?s input pins. the eight analog input pins are divided into two groups: group 0 (an 0 to an 3 ), and group 1 (an 4 to an 7 ). av cc and av ss are the power supply for the analog circuits in the a/d converter. v ref is the a/d conversion reference voltage. table 15.1 a/d converter pins pin name abbre- viation i/o function analog power supply pin av cc input analog power supply analog ground pin av ss input analog ground and reference voltage reference voltage pin v ref input analog reference voltage analog input pin 0 an 0 input group 0 analog inputs analog input pin 1 an 1 input analog input pin 2 an 2 input analog input pin 3 an 3 input analog input pin 4 an 4 input group 1 analog inputs analog input pin 5 an 5 input analog input pin 6 an 6 input analog input pin 7 an 7 input a/d external trigger input pin adtrg input external trigger input for starting a/d conversion
section 15 a/d converter rev. 3.00 sep 27, 2006 page 544 of 872 rej09b0325-0300 15.1.4 register configuration table 15.2 summarizes the a/d converter?s registers. table 15.2 a/d converter registers address * 1 name abbreviation r/w initial value h'ffe0 a/d data register a (high) addrah r h'00 h'ffe1 a/d data register a (low) addral r h'00 h'ffe2 a/d data register b (high) addrbh r h'00 h'ffe3 a/d data register b (low) addrbl r h'00 h'ffe4 a/d data register c (high) addrch r h'00 h'ffe5 a/d data register c (low) addrcl r h'00 h'ffe6 a/d data register d (high) addrdh r h'00 h'ffe7 a/d data register d (low) addrdl r h'00 h'ffe8 a/d control/status register adcsr r/(w) * 2 h'00 h'ffe9 a/d control register adcr r/w h'7e * 3 notes: 1. lower 16 bits of the address 2. only 0 can be written in bit 7, to clear the flag. 3. initial value is h'7f in mask rom versions, prom versions, and dual power supply flash memory versions.
section 15 a/d converter rev. 3.00 sep 27, 2006 page 545 of 872 rej09b0325-0300 15.2 register descriptions 15.2.1 a/d data registers a to d (addra to addrd) bit addrn initial value 14 ad8 0 r 12 ad6 0 r 10 ad4 0 r 8 ad2 0 r 6 ad0 0 r 0 ? 0 r 4 ? 0 r 2 ? 0 r 15 ad9 0 r 13 ad7 0 r 11 ad5 0 r 9 ad3 0 r 7 ad1 0 r 1 ? 0 r 5 ? 0 r 3 ? 0 r a/d conversion data 10-bit data giving an a/d conversion result reserved bits read/write (n = a to d) the four a/d data registers (addra to addrd) are 16-bit read-only registers that store the results of a/d conversion. an a/d conversion produces 10-bit data, which is transferred for storage into the a/d data register corresponding to the selected channel. the upper 8 bits of the result are stored in the upper byte of the a/d data register. the lower 2 bits are stored in the lower byte. bits 5 to 0 of an a/d data register are reserved bits that are always read as 0. table 15.3 indicates the pairings of analog input channels and a/d data registers. the cpu can always read and write the a/d data registers. the upper byte can be read directly, but the lower byte is read through a temporary register (temp). for details see section 15.3, cpu interface. the a/d data registers are initialized to h'0000 by a reset and in standby mode. table 15.3 analog input channels and a/d data registers analog input channel group 0 group 1 a/d data register an 0 an 4 addra an 1 an 5 addrb an 2 an 6 addrc an 3 an 7 addrd
section 15 a/d converter rev. 3.00 sep 27, 2006 page 546 of 872 rej09b0325-0300 15.2.2 a/d control/status register (adcsr) bit initial value read/write 7 adf 0 r/(w) 6 adie 0 r/w 5 adst 0 r/w 4 scan 0 r/w 3 cks 0 r/w 0 ch0 0 r/w 2 ch2 0 r/w 1 ch1 0 r/w * note: * only 0 can be written, to clear the flag. a/d end flag indicates end of a/d conversion a/d interrupt enable enables and disables a/d end interrupts a/d start starts or stops a/d conversion scan mode selects single mode or scan mode clock select selects the a/d conversion time channel select 2 to 0 these bits select analog input channels adcsr is an 8-bit readable/writable register that selects the mode and controls the a/d converter. adcsr is initialized to h'00 by a reset and in standby mode. bit 7?a/d end flag (adf): indicates the end of a/d conversion. bit 7: adf description 0 [clearing condition] (initial value) cleared by reading adf while adf = 1, then writing 0 in adf 1 [setting conditions] single mode: a/d conversion ends scan mode: a/d conversion ends in all selected channels
section 15 a/d converter rev. 3.00 sep 27, 2006 page 547 of 872 rej09b0325-0300 bit 6?a/d interrupt enable (adie): enables or disables the interrupt (adi) requested at the end of a/d conversion. bit 6: adie description 0 a/d end interrupt request (adi) is disabled (initial value) 1 a/d end interrupt request (adi) is enabled bit 5?a/d start (adst): starts or stops a/d conversion. the adst bit remains set to 1 during a/d conversion. it can also be set to 1 by external trigger input at the adtrg pin. bit 5: adst description 0 a/d conversion is stopped (initial value) 1 single mode: a/d conversion starts; adst is automatically cleared to 0 when conversion ends. scan mode: a/d conversion starts and continues, cycling among the selected channels, until adst is cleared to 0 by software, by a reset, or by a transition to standby mode. bit 4?scan mode (scan): selects single mode or scan mode. for further information on operation in these modes, see section 15.4, operation. clear the adst bit to 0 before switching the conversion mode. bit 4: scan description 0 single mode (initial value) 1 scan mode bit 3?clock select (cks): selects the a/d conversion time. clear the adst bit to 0 before switching the conversion time. bit 3: cks description 0 conversion time = 266 states (maximum) (initial value) 1 conversion time = 134 states (maximum) bits 2 to 0?channel select 2 to 0 (ch2 to ch0): these bits and the scan bit select the analog input channels. clear the adst bit to 0 before changing the channel selection.
section 15 a/d converter rev. 3.00 sep 27, 2006 page 548 of 872 rej09b0325-0300 group selection channel selection description ch2 ch1 ch0 single mode scan mode 000an 0 (initial value) an 0 1an 1 an 0 , an 1 10 an 2 an 0 to an 2 1an 3 an 0 to an 3 100an 4 an 4 1an 5 an 4 , an 5 10 an 6 an 4 to an 6 1an 7 an 4 to an 7 15.2.3 a/d control register (adcr) bit initial value read/write 7 trge 0 r/w 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 ? 1 ? 0 ? 0 ? 2 ? 1 ? 1 ? 1 ? trigger enable enables or disables external triggering of a/d conversion reserved bits reserved bit must not be set to 1 adcr is an 8-bit readable/writable register that enables or disables external triggering of a/d conversion. adcr is initialized to h'7e by a reset and in standby mode. bit 7?trigger enable (trge): enables or disables external triggering of a/d conversion. bit 7: trge description 0 a/d conversion cannot be externally triggered (initial value) 1 a/d conversion starts at the falling edge of the external trigger signal ( adtrg ) bits 6 to 1?reserved: read-only bits, always read as 1. bit 0?reserved: do not set to 1.
section 15 a/d converter rev. 3.00 sep 27, 2006 page 549 of 872 rej09b0325-0300 15.3 cpu interface addra to addrd are 16-bit registers, but they are connected to the cpu by an 8-bit data bus. therefore, although the upper byte can be be accessed directly by the cpu, the lower byte is read through an 8-bit temporary register (temp). an a/d data register is read as follows. when the upper byte is read, the upper-byte value is transferred directly to the cpu and the lower-byte value is transferred into temp. next, when the lower byte is read, the temp contents are transferred to the cpu. when reading an a/d data register, always read the upper byte before the lower byte. it is possible to read only the upper byte, but if only the lower byte is read, incorrect data may be obtained. figure 15.2 shows the data flow for access to an a/d data register. upper-byte read bus interface module data bus cpu (h'aa) addrnh (h'aa) addrnl (h'40) lower-byte read bus interface module data bus cpu (h'40) addrnh (h'aa) addrnl (h'40) temp (h'40) temp (h'40) (n = a to d) (n = a to d) figure 15.2 a/d data register access operation (reading h'aa40)
section 15 a/d converter rev. 3.00 sep 27, 2006 page 550 of 872 rej09b0325-0300 15.4 operation the a/d converter operates by successive approximations with 10-bit resolution. it has two operating modes: single mode and scan mode. 15.4.1 single mode (scan = 0) single mode should be selected when only one a/d conversion on one channel is required. a/d conversion starts when the adst bit is set to 1 by software, or by external trigger input. the adst bit remains set to 1 during a/d conversion and is automatically cleared to 0 when conversion ends. when conversion ends the adf bit is set to 1. if the adie bit is also set to 1, an adi interrupt is requested at this time. to clear the adf flag to 0, first read adcsr, then write 0 in adf. when the mode or analog input channel must be switched during analog conversion, to prevent incorrect operation, first clear the adst bit to 0 in adcsr to halt a/d conversion. after making the necessary changes, set the adst bit to 1 to start a/d conversion again. the adst bit can be set at the same time as the mode or channel is changed. typical operations when channel 1 (an 1 ) is selected in single mode are described next. figure 15.3 shows a timing diagram for this example. 1. single mode is selected (scan = 0), input channel an 1 is selected (ch2 = ch1 = 0, ch0 = 1), the a/d interrupt is enabled (adie = 1), and a/d conversion is started (adst = 1). 2. when a/d conversion is completed, the result is transferred into addrb. at the same time the adf flag is set to 1, the adst bit is cleared to 0, and the a/d converter becomes idle. 3. since adf = 1 and adie = 1, an adi interrupt is requested. 4. the a/d interrupt handling routine starts. 5. the routine reads adcsr, then writes 0 in the adf flag. 6. the routine reads and processes the conversion result (addrb). 7. execution of the a/d interrupt handling routine ends. after that, if the adst bit is set to 1, a/d conversion starts again and steps 2 to 7 are repeated.
section 15 a/d converter rev. 3.00 sep 27, 2006 page 551 of 872 rej09b0325-0300 adie adst adf state of channel 0 (an ) set set set clear clear idle idle idle idle a/d conversion (1) a/d conversion (2) idle read conversion result a/d conversion result (1) read conversion result a/d conversion result (2) note: * vertical arrows ( ) indicate instructions executed by software. 0 1 2 3 a/d conversion starts * * * * * addra addrb addrc addrd state of channel 1 (an ) state of channel 2 (an ) state of channel 3 (an ) idle figure 15.3 example of a/d converter operation (single mode, channel 1 selected)
section 15 a/d converter rev. 3.00 sep 27, 2006 page 552 of 872 rej09b0325-0300 15.4.2 scan mode (scan = 1) scan mode is useful for monitoring analog inputs in a group of one or more channels. when the adst bit is set to 1 by software or external trigger input, a/d conversion starts on the first channel in the group (an 0 when ch2 = 0, an 4 when ch2 = 1). when two or more channels are selected, after conversion of the first channel ends, conversion of the second channel (an 1 or an 5 ) starts immediately. a/d conversion continues cyclically on the selected channels until the adst bit is cleared to 0. the conversion results are transferred for storage into the a/d data registers corresponding to the channels. when the mode or analog input channel selection must be changed during analog conversion, to prevent incorrect operation, first clear the adst bit to 0 in adcsr to halt a/d conversion. after making the necessary changes, set the adst bit to 1. a/d conversion will start again from the first channel in the group. the adst bit can be set at the same time as the mode or channel selection is changed. typical operations when three channels in group 0 (an 0 to an 2 ) are selected in scan mode are described next. figure 15.4 shows a timing diagram for this example. 1. scan mode is selected (scan = 1), scan group 0 is selected (ch2 = 0), analog input channels an 0 to an 2 are selected (ch1 = 1, ch0 = 0), and a/d conversion is started (adst = 1). 2. when a/d conversion of the first channel (an 0 ) is completed, the result is transferred into addra. next, conversion of the second channel (an 1 ) starts automatically. 3. conversion proceeds in the same way through the third channel (an 2 ). 4. when conversion of all selected channels (an 0 to an 2 ) is completed, the adf flag is set to 1 and conversion of the first channel (an 0 ) starts again. if the adie bit is set to 1, an adi interrupt is requested at this time. 5. steps 2 to 4 are repeated as long as the adst bit remains set to 1. when the adst bit is cleared to 0, a/d conversion stops. after that, if the adst bit is set to 1, a/d conversion starts again from the first channel (an 0 ).
section 15 a/d converter rev. 3.00 sep 27, 2006 page 553 of 872 rej09b0325-0300 a dst a df state of channel 0 (an ) 0 1 2 3 continuous a/d conversion set * 1 clear * 1 clear * 1 idle a/d conversion (1) idle idle idle a/d conversion (4) idle a/d conversion (2) idle a/d conversion (5) * 2 idle a/d conversion (3) idle idle transfer a/d conversion result (1) a/d conversion result (4) a/d conversion result (2) a/d conversion result (3) 1. 2. a/d conversion time notes: a ddra a ddrb a ddrc a ddrd state of channel 1 (an ) state of channel 2 (an ) state of channel 3 (an ) vertical arrows ( ) indicate instructions executed by software. data currently being converted is ignored. figure 15.4 example of a/d converter operation (scan mode, channels an 0 to an 2 selected)
section 15 a/d converter rev. 3.00 sep 27, 2006 page 554 of 872 rej09b0325-0300 15.4.3 input sampling and a/d conversion time the a/d converter has a built-in sample-and-hold circuit. the a/d converter samples the analog input at a time t d after the adst bit is set to 1, then starts conversion. figure 15.5 shows the a/d conversion timing. table 15.4 indicates the a/d conversion time. as indicated in figure 15.5, the a/d conversion time includes t d and the input sampling time. the length of t d varies depending on the timing of the write access to adcsr. the total conversion time therefore varies within the ranges indicated in table 15.4. in scan mode, the values given in table 15.4 apply to the first conversion. in the second and subsequent conversions the conversion time is fixed at 256 states when cks = 0 or 128 states when cks = 1. address bus write signal input sampling timing adf (1) (2) t d t spl t conv legend: (1): (2): t : t : t : d spl conv adcsr write cycle adcsr address synchronization delay input sampling time a/d conversion time figure 15.5 a/d conversion timing
section 15 a/d converter rev. 3.00 sep 27, 2006 page 555 of 872 rej09b0325-0300 table 15.4 a/d conversion time (single mode) cks = 0 cks = 1 symbol min typ max min typ max synchronization delay t d 10 ? 17 6 ? 9 input sampling time t spl ?63? ?31? a/d conversion time t conv 259 ? 266 131 ? 134 note: values in the table are numbers of states. 15.4.4 external trigger input timing a/d conversion can be externally triggered. when the trge bit is set to 1 in adcr, external trigger input is enabled at the adtrg pin. a high-to-low transition at the adtrg pin sets the adst bit to 1 in adcsr, starting a/d conversion. other operations, in both single and scan modes, are the same as if the adst bit had been set to 1 by software. figure 15.6 shows the timing. adtrg internal trigger signal adst a/d conversion figure 15.6 external trigger input timing
section 15 a/d converter rev. 3.00 sep 27, 2006 page 556 of 872 rej09b0325-0300 15.5 interrupts the a/d converter generates an interrupt (adi) at the end of a/d conversion. the adi interrupt request can be enabled or disabled by the adie bit in adcsr. 15.6 usage notes when using the a/d converter, note the following points: 1. analog input voltage range: during a/d conversion, the voltages input to the analog input pins should be in the range av ss
section 15 a/d converter rev. 3.00 sep 27, 2006 page 557 of 872 rej09b0325-0300 5. note on noise: to prevent damage from surges and other abnormal voltages at the analog input pins (an 0 to an 7 ) and analog reference voltage pin (v ref ), connect a protection circuit like the one in figure 15.7 between av cc and av ss . the bypass capacitors connected to av cc and v ref and the filter capacitors connected to an 0 to an 7 must be connected to av ss . if filter capacitors like the ones in figure 15.7 are connected, the voltage values input to the analog input pins (an 0 to an 7 ) will be smoothed, which may give rise to error. error can also occur if a/d conversion is frequently performed in scan mode so that the current that charges and discharges the capacitor in the sample-and-hold circuit of the a/d converter becomes greater than that input to the analog input pins via input impedance r in . the circuit constants should therefore be selected carefully. av cc * 1 * 1 * 2 v ref an 0 to an 7 av ss notes: 1. numeric values are approximate. 2. r in : input impedance r in 100 ? figure 15.7 example of analog input protection circuit
section 15 a/d converter rev. 3.00 sep 27, 2006 page 558 of 872 rej09b0325-0300 20 pf to a/d converter an 0 to an 7 10 k ? figure 15.8 analog input pin equivalent circuit table 15.5 analog input pin ratings item min max unit analog input capacitance ? 20 pf allowable signal-source impedance ? 10 k ? ? 5k ?  resolution digital output code length of a/d converter  offset error deviation from ideal a/d conversion characteristic of analog input voltage required to raise digital output from minimum voltage value b'0000000000 to b'0000000001 (figure 15.10)  full-scale error deviation from ideal a/d conversion characteristic of analog input voltage required to raise digital output from b'1111111110 to b'1111111111 (figure 15.10)  quantization error intrinsic error of the a/d converter; 1/2 lsb (figure 15.9)  nonlinearity error deviation from ideal a/d conversion characteristic in range from zero volts to full scale, exclusive of offset error, full-scale error, and quantization error.  absolute accuracy deviation of digital value from analog input value, including offset error, full-scale error, quantization error, and nonlinearity error.
section 15 a/d converter rev. 3.00 sep 27, 2006 page 559 of 872 rej09b0325-0300 111 110 101 100 011 010 001 000 1/8 2/8 3/8 4/8 5/8 6/8 7/8 fs quantization error analog input voltage digital output ideal a/d conversion characteristic figure 15.9 a/d converter accuracy definitions (1) fs offset error nonlinearity error actual a/d conversion characteristic analog input voltage digital output ideal a/d conversion characteristic full-scale error figure 15.10 a/d converter accuracy definitions (2)
section 15 a/d converter rev. 3.00 sep 27, 2006 page 560 of 872 rej09b0325-0300 7. allowable signal-source impedance: the analog inputs of the h8/3048b group are designed to assure accurate conversion of input signals with a signal-source impedance not exceeding 10 k ? ? ? ? ? ? ( ? ( > figure 15.11 analog input circuit (example)
section 16 d/a converter rev. 3.00 sep 27, 2006 page 561 of 872 rej09b0325-0300 section 16 d/a converter 16.1 overview the h8/3048b group includes a d/a converter with two channels. 16.1.1 features d/a converter features are listed below. ? eight-bit resolution ? two output channels ? conversion time: maximum 10 s (with 20-pf capacitive load) ? output voltage: 0 v to 255/256 v ref ? d/a outputs can be sustained in software standby mode
section 16 d/a converter rev. 3.00 sep 27, 2006 page 562 of 872 rej09b0325-0300 16.1.2 block diagram figure 16.1 shows a block diagram of the d/a converter. dadr0 dadr1 dacr dastcr v av da da av ref cc ss 0 1 legend: dacr: dadr0: dadr1: dastcr: 8-bit d/a module data bus bus interface internal data bus control circuit d/a control register d/a data register 0 d/a data register 1 d/a standby control register figure 16.1 d/a converter block diagram
section 16 d/a converter rev. 3.00 sep 27, 2006 page 563 of 872 rej09b0325-0300 16.1.3 input/output pins table 16.1 summarizes the d/a converter?s input and output pins. table 16.1 d/a converter pins pin name abbreviation i/o function analog power supply pin av cc input analog power supply analog ground pin av ss input analog ground and reference voltage analog output pin 0 da 0 output analog output, channel 0 analog output pin 1 da 1 output analog output, channel 1 reference voltage input pin v ref input analog reference voltage 16.1.4 register configuration table 16.2 summarizes the d/a converter?s registers. table 16.2 d/a converter registers address * name abbreviation r/w initial value h'ffdc d/a data register 0 dadr0 r/w h'00 h'ffdd d/a data register 1 dadr1 r/w h'00 h'ffde d/a control register dacr r/w h'1f h'ff5c d/a standby control register dastcr r/w h'fe note: * lower 16 bits of the address
section 16 d/a converter rev. 3.00 sep 27, 2006 page 564 of 872 rej09b0325-0300 16.2 register descriptions 16.2.1 d/a data registers 0 and 1 (dadr0, dadr1) bit initial value read/write 7 0 r/w 6 0 r/w 5 0 r/w 4 0 r/w 3 0 r/w 2 0 r/w 1 0 r/w 0 0 r/w the d/a data registers (dadr0 and dadr1) are 8-bit readable/writable registers that store the data to be converted. when analog output is enabled, the d/a data register values are constantly converted and output at the analog output pins. the d/a data registers are initialized to h'00 by a reset and in standby mode. 16.2.2 d/a control register (dacr) bit initial value read/write 7 daoe1 0 r/w 6 daoe0 0 r/w 5 dae 0 r/w 4 ? 1 ? 3 ? 1 ? 2 ? 1 ? 1 ? 1 ? 0 ? 1 ? d/a output enable 1 d/a output enable 0 d/a enable controls d/a conversion and analog output controls d/a conversion and analog output controls d/a conversion dacr is an 8-bit readable/writable register that controls the operation of the d/a converter. dacr is initialized to h'1f by a reset and in standby mode.
section 16 d/a converter rev. 3.00 sep 27, 2006 page 565 of 872 rej09b0325-0300 bit 7?d/a output enable 1 (daoe1): controls d/a conversion and analog output. bit 7: daoe1 description 0da 1 analog output is disabled (initial value) 1 channel-1 d/a conversion and da 1 analog output are enabled bit 6?d/a output enable 0 (daoe0): controls d/a conversion and analog output. bit 6: daoe0 description 0da 0 analog output is disabled (initial value) 1 channel-0 d/a conversion and da 0 analog output are enabled bit 5?d/a enable (dae): controls d/a conversion, together with bits daoe0 and daoe1. when the dae bit is cleared to 0, analog conversion is controlled independently in channels 0 and 1. when the dae bit is set to 1, analog conversion is controlled together in channels 0 and 1. output of the conversion results is always controlled independently by daoe0 and daoe1. bit 7: daoe1 bit 6: daoe0 bit 5: dae description 0 0 ? d/a conversion is disabled in channels 0 and 1 1 0 d/a conversion is enabled in channel 0 d/a conversion is disabled in channel 1 1 d/a conversion is enabled in channels 0 and 1 100d/a conversion is disabled in channel 0 d/a conversion is enabled in channel 1 1 d/a conversion is enabled in channels 0 and 1 1 ? d/a conversion is enabled in channels 0 and 1 when the dae bit is set to 1, even if bits daoe0 and daoe1 in dacr and the adst bit in adcsr are cleared to 0, the same current is drawn from the analog power supply as during a/d and d/a conversion. bits 4 to 0?reserved: read-only bits, always read as 1.
section 16 d/a converter rev. 3.00 sep 27, 2006 page 566 of 872 rej09b0325-0300 16.2.3 d/a standby control register (dastcr) dastcr is an 8-bit readable/writable register that enables or disables d/a output in software standby mode. bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 ? 1 ? 0 daste 0 r/w 2 ? 1 ? 1 ? 1 ? reserved bits d/a standby enable enables or disables d/a output in software standby mode dastcr is initialized to h'fe by a reset and in hardware standby mode. it is not initialized in software standby mode. bits 7 to 1?reserved: read-only bits, always read as 1. bit 0?d/a standby enable (daste): enables or disables d/a output in software standby mode. bit 0: daste description 0 d/a output is disabled in software standby mode (initial value) 1 d/a output is enabled in software standby mode
section 16 d/a converter rev. 3.00 sep 27, 2006 page 567 of 872 rej09b0325-0300 16.3 operation the d/a converter has two built-in d/a conversion circuits that can perform conversion independently. d/a conversion is performed constantly while enabled in dacr. if the dadr0 or dadr1 value is modified, conversion of the new data begins immediately. the conversion results are output when bits daoe0 and daoe1 are set to 1. an example of d/a conversion on channel 0 is given next. timing is indicated in figure 16.2. 1. data to be converted is written in dadr0. 2. bit daoe0 is set to 1 in dacr. d/a conversion starts and da 0 becomes an output pin. the converted result is output after the conversion time. the output value is (dadr0 contents/256) v ref . output of this conversion result continues until the value in dadr0 is modified or the daoe0 bit is cleared to 0. 3. if the dadr0 value is modified, conversion starts immediately, and the result is output after the conversion time. 4. when the daoe0 bit is cleared to 0, da 0 becomes an input pin. dadr0 write cycle dacr write cycle dadr0 write cycle dacr write cycle address bus dadr0 daoe0 da 0 conversion data 1 conversion data 2 high-impedance state conversion result 1 conversion result 2 t dconv t dconv legend: t : d/a conversion time dconv figure 16.2 example of d/a converter operation
section 16 d/a converter rev. 3.00 sep 27, 2006 page 568 of 872 rej09b0325-0300 16.4 d/a output control in the h8/3048b group, d/a converter output can be enabled or disabled in software standby mode. when the daste bit is set to 1 in dastcr, d/a converter output is enabled in software standby mode. the d/a converter registers retain the values they held prior to the transition to software standby mode. when d/a output is enabled in software standby mode, the reference supply current is the same as during normal operation.
section 17 ram rev. 3.00 sep 27, 2006 page 569 of 872 rej09b0325-0300 section 17 ram 17.1 overview the h8/3048b group has 4 kbytes of high-speed static ram on-chip. the ram is connected to the cpu by a 16-bit data bus. the cpu accesses both byte data and word data in two states, making the ram useful for rapid data transfer. the on-chip ram of the h8/3048b group is assigned to addresses h'fef10 to h'fff0f in modes 1, 2, 5, and 7, and to addresses h'ffef10 to h'ffff0f in modes 3, 4, and 6. the ram enable bit (rame) in the system control register (syscr) can enable or disable the on-chip ram.
section 17 ram rev. 3.00 sep 27, 2006 page 570 of 872 rej09b0325-0300 17.1.1 block diagram figure 17.1 shows a block diagram of the on-chip ram. h'fef10 * h'fef12 * h'fff0e * h'fef11 * h'fef13 * h'fff0f * internal data bus (upper 8 bits) internal data bus (lower 8 bits) bus interface syscr on-chip ram even addresses odd addresses legend: syscr: system control register note: * this example is of the operating in mode 7. the lower 20 bits of the address are shown. figure 17.1 ram block diagram 17.1.2 register configuration the on-chip ram is controlled by syscr. table 17.1 gives the address and initial value of syscr. table 17.1 system control register address * name abbreviation r/w initial value h'fff2 system control register syscr r/w h'0b note: * lower 16 bits of the address.
section 17 ram rev. 3.00 sep 27, 2006 page 571 of 872 rej09b0325-0300 17.2 system control register (syscr) bit initial value read/write 7 ssby 0 r/w 6 sts2 0 r/w 5 sts1 0 r/w 4 sts0 0 r/w 3 ue 1 r/w 2 nmieg 0 r/w 1 ? 1 ? 0 rame 1 r/w software standby standby timer select 2 to 0 user bit enable nmi edge select reserved bit ram enable enables or disables on-chip ram one function of syscr is to enable or disable access to the on-chip ram. the on-chip ram is enabled or disabled by the rame bit in syscr. for details about the other bits, see section 3.3, system control register (syscr). bit 0?ram enable (rame): enables or disables the on-chip ram. the rame bit is initialized at the rising edge of the input at the res pin. it is not initialized in software standby mode. bit 0: rame description 0 on-chip ram is disabled 1 on-chip ram is enabled (initial value)
section 17 ram rev. 3.00 sep 27, 2006 page 572 of 872 rej09b0325-0300 17.3 operation when the rame bit is set to 1, the on-chip ram is enabled. accesses to addresses h'fef10 to h'fff0f in the h8/3048b group in modes 1, 2, 5, and 7, addresses h'ffef10 to h'ffff0f in the h8/3048b group in modes 3, 4, and 6 are directed to the on-chip ram. in modes 1 to 6 (expanded modes), when the rame bit is cleared to 0, the off-chip address space is accessed. in mode 7 (single-chip mode), when the rame bit is cleared to 0, the on-chip ram is not accessed: read access always results in h'ff data, and write access is ignored. since the on-chip ram is connected to the cpu by an internal 16-bit data bus, it can be written and read by word access. it can also be written and read by byte access. byte data is accessed in two states using the upper 8 bits of the data bus. word data starting at an even address is accessed in two states using all 16 bits of the data bus.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 573 of 872 rej09b0325-0300 section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) 18.1 flash memory overview 18.1.1 notes on h8/3048f-one (single power supply) there are two models of the h8/3048f-ztat with on-chip flash memory: a dual power supply model (h8/3048f) and single power supply model (h8/3048f-one). points to be noted when using the h8/3048f-one single power supply is given below. for the differences between the dual power supply model and single power supply model (h8/3048f-one), see section 1.4.3, differences between h8/3048f and h8/3048f-one. (1) voltage application 12 v must not be applied to the h8/3048f-one (single power supply), as this will permanently damage the device. the flash memory programming power supply for the h8/3048f-one (single power supply) is v cc . the programming power supply for the dual power supply model is the v pp pin (12 v), but there is no v pp pin in the single power supply model. in the h8/3048f-one (single power supply) model the fwe pin is provided at the same pin position as the v pp pin in the dual power source model, but fwe is not a power supply pin?it is used to control flash memory write enabling. also, in boot mode, 12 v must be applied to the md 2 pin in the dual power supply model, but this is not necessary in the h8/3048f-one (single power supply). the maximum rating of the fwe and md 2 pins in the h8/3048f-one (single power supply) is v cc +0.3 v. applying a voltage in excess of the maximum rating will permanently damage the device. do not select the hn28f101 programmer setting for the h8/3048f-one (single power supply). if this setting is made by mistake, 12.0 v will be applied to the fwe pin, permanently damaging the device. when using a prom programmer to program the on-chip flash memory in the h8/3048f- one (single power supply), use a prom programmer that supports renesas technology microcomputer device types with 128-kbyte on-chip flash memory.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 574 of 872 rej09b0325-0300 18.1.2 mode pin settings the h8/3048f-one has 128 kbytes of on-chip flash memory. the flash memory is connected to the cpu by a 16-bit data bus. the cpu accesses both byte data and word data in two states, enabling rapid data transfer. the mode pins (md 2 to md 0 ), fwe pin, and rxd1 pin can be set to enable or disable the on-chip rom as indicated in table 18.1. table 18.1 operating mode and rom pin name mode md 2 md 1 md 0 fwe rxd1 on-chip rom mode 1 (1-mbyte expanded mode with on-chip rom disabled) 00100/1 mode 2 (1-mbyte expanded mode with on-chip rom disabled) 01000/1 mode 3 (16-mbyte expanded mode with on-chip rom disabled) 01100/1 mode 4 (16-mbyte expanded mode with on-chip rom disabled) 10000/1 disabled (external address area) mode 5 (1-mbyte expanded mode with on-chip rom enabled) 10100/1 mode 6 (16-mbyte expanded mode with on-chip rom enabled) 11000/1 mode 7 (single-chip mode) 1 1 1 0 0/1 enabled the h8/3048f-one can be set to prom mode and programmed with a general-purpose prom programmer.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 575 of 872 rej09b0325-0300 18.2 flash memory features the h8/3048f-one has 128 kbytes of on-chip flash memory. the features of the flash memory are summarized below. ? four flash memory operating modes ? program mode ? erase mode ? program-verify mode ? erase-verify mode ? programming/erase methods the flash memory is programmed 128 bytes at a time. block erase (in single-block units) can be performed. to erase the entire flash memory, each block must be erased in turn. block erasing can be performed as required on 1 kbyte, 28 kbytes, and 32 kbytes blocks. ? programming/erase times the flash memory programming time is 10 ms (typ.) for simultaneous 128-byte programming, equivalent approximately to 80 s (typ.) per byte, and the erase time is 100 ms (typ.). ? reprogramming capability the flash memory can be reprogrammed up to 100 times. ? on-board programming modes there are two modes in which flash memory can be programmed/erased/verified on-board: ? boot mode ? user program mode in the boot mode, the transferred program from the host can be recognized. ? automatic bit rate adjustment with data transfer in boot mode, the lsi?s bit rate can be automatically adjusted to match the transfer bit rate of the host. ? flash memory emulation in ram flash memory programming can be emulated in real time by overlapping a part of ram onto flash memory. ? protect modes there are three protect modes, hardware, software, and error which allow protected status to be designated for flash memory program/erase/verify operations. ? prom mode flash memory can be programmed/erased in prom mode, using a prom programmer, as well as in on-board programming mode.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 576 of 872 rej09b0325-0300 18.2.1 block diagram module bus bus interface/controller flash memory (128 kbytes) operating mode flmcr2 internal address bus internal data bus (16 bits) fwe pin mode pin ebr ramcr flmcr1 flash memory control register 1 flash memory control register 2 erase block register ram control register legend: flmcr1: flmcr2: ebr: ramcr: note: never apply 12 v to the h8/3048f-one (single power supply). otherwise, the lsi will be permanently damaged. figure 18.1 block diagram of flash memory 18.2.2 mode transitions when the mode pins and the fwe pin are set in the reset state and a reset-start is executed, the microcomputer enters an operating mode as shown in figure 18.2. in user mode, flash memory can be read but not programmed or erased. the boot, user program and prom modes are provided as modes to write and erase the flash memory.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 577 of 872 rej09b0325-0300 boot mode on-board programming mode user program mode user mode reset state prom mode res = 0 fwe = 1 fwe = 0 * 3 * 3 * 1, * 3 * 1 * 2 notes: only make a transition between user mode and user program mode when the cpu is not accessing the flash memory. 1. ram emulation possible 2. the h8/3048f-one is placed in prom mode by means of a dedicated prom writer. 3. mode settings are shown in the following table. 4. for pins rxd1 and txd1, use on-board pull-up in boot mode. res = 0 res = 0 res = 0 mode fwe md 2 md 1 md 0 mode 1 mode 2 mode 3 mode 4 mode 5 mode 6 mode 7 boot mode 5 boot mode 6 boot mode 7 setting prohibited user program mode 5 user program mode 6 user program mode 7 0 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 1 1 0 0 1 1 0 1 1 0 0 1 1 1 0 1 0 1 0 1 1 0 1 0 1 0 1 rxd1 0, 1 0, 1 0, 1 0, 1 0, 1 0, 1 0, 1 1 * 4 1 * 4 1 * 4 1 0, 1 0, 1 0, 1 pins figure 18.2 flash memory state transitions
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 578 of 872 rej09b0325-0300 state transitions between the normal user mode and on-board programming mode are performed by changing the fwe pin level from high to low or from low to high. to prevent misoperation (erroneous programming or erasing) in these cases, the bits in the flash memory control registers (flmcr1 and flmcr2) should be cleared to 0 before making such a transition. after the bits are cleared, a wait time is necessary. normal operation is not guaranteed if this wait time is insufficient.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 579 of 872 rej09b0325-0300 18.2.3 on-board programming modes boot mode flash memory h8/3048f-one ram host programming control program sci application program (old version) new application program flash memory h8/3048f-one ram host sci application program (old version) boot program area new application program flash memory h8/3048f-one ram host sci flash memory preprogramming erase boot program new application program flash memory h8/3048f-one program execution state ram host sci new application program boot program programming control program 1. initial state the old program version or data remains written in the flash memory. the user should prepare the programming control program and new application program beforehand in the host. 2. programming control program transfer when boot mode is entered, the boot program in the h8/3048f-one (originally incorporated in the chip) is started and the programming control program in the host is transferred to ram via sci communication. the boot program required for flash memory erasing is automatically transferred to the ram boot program area. 3. flash memory initialization the erase program in the boot program area (in ram) is executed, and the flash memory is initialized (to h'ff). in boot mode, total flash memory erasure is performed, without regard to blocks. 4. writing new application program the programming control program is recognized if it corresponds to the h8/3048f-one. the programming control program is then transferred from the host to ram is executed, and the new application program in the host is written into the flash memory. programming control program boot program boot program boot program area boot program area programming control program note: never apply 12 v to the h8/3048f-one (single power supply). otherwise, the lsi will be permanently damaged.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 580 of 872 rej09b0325-0300 user program mode flash memory h8/3048f-one ram host programming/ erase control program sci boot program new application program flash memory h8/3048f-one ram host sci new application program flash memory h8/3048f-one ram host sci flash memory erase boot program new application program flash memory h8/3048f-one program execution state ram host sci boot program boot program fwe assessment program application program (old version) new application program 1. initial state the fwe assessment program that confirms that user program mode has been entered, and the program that will transfer the programming/erase control program from flash memory to on-chip ram should be written into the flash memory by the user beforehand. the programming/erase control program should be prepared in the host or in the flash memory. 2. programming/erase control program transfer when user program mode is entered, user software confirms this fact, executes transfer program in the flash memory, and transfers the programming/erase control program to ram. 3. flash memory initialization the programming/erase program in ram is executed, and the flash memory is initialized (to h'ff). erasing can be performed in block units, but not in byte units. 4. writing new application program next, the new application program in the host is written into the erased flash memory blocks. do not write to unerased blocks. programming/ erase control program programming/ erase control program programming/ erase control program transfer program application program (old version) transfer program fwe assessment program fwe assessment program transfer program fwe assessment program transfer program note: never apply 12 v to the h8/3048f-one (single power supply). otherwise, the lsi will be permanently damaged.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 581 of 872 rej09b0325-0300 18.2.4 flash memory emulation in ram in the h8/3048f-one, flash memory programming can be emulated in real time by overlapping the flash memory with part of ram ( ? overlap ram ? ). when the emulation block set in ramcr is accessed while the emulation function is being executed, data written in the overlap ram is read. emulation should be performed in user mode or user program mode. application program execution state flash memory emulation block ram sci overlap ram (emulation is performed on data written in ram) figure 18.3 reading overlap ram data in user mode or user program mode when overlap ram data is confirmed, clear the rams bit to release ram overlap, and actually perform writes to the flash memory. when the programming control program is transferred to ram in on-board programming mode, ensure that the transfer destination and the overlap ram do not overlap, as this will cause data in the overlap ram to be rewritten.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 582 of 872 rej09b0325-0300 application program flash memory ram sci programming control program execution state overlap ram (programming data) programming data figure 18.4 writing overlap ram data in user program mode 18.2.5 differences between boot mode and user program mode item boot mode user program mode total erase yes no block erase no yes programming control program * boot program is initiated, and programming control program is transferred from host to on-chip ram, and executed there. program that controls programming program in flash memory is executed. program should be written beforehand in prom mode and boot mode. note: * to be provided by the user, in accordance with the recommended algorithm.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 583 of 872 rej09b0325-0300 18.2.6 block configuration the flash memory in the h8/3048f-one is divided into three 32-kbyte blocks, one 28-kbyte block, and four 1-kbyte blocks and can be erased in these block units. address h'00000 address h'1ffff 28 kbytes 32 kbytes 32 kbytes 32 kbytes 128 kbytes 1 kbyte 4 figure 18.5 erase area block divisions 18.3 flash memory pin configuration the flash memory is controlled by means of the pins shown in table 18.2. table 18.2 pin configuration pin name abbreviation i/o function reset res input reset flash write enable fwe * 1 input flash program/erase protection by hardware mode 2 md2 * 1 input sets lsi operating mode mode 1 md1 input sets lsi operating mode mode 0 md0 input sets lsi operating mode transmit data txd1 * 2 output serial transmit data output receive data rxd1 * 2 input serial receive data input notes: 1. never apply 12 v to the h8/3048f-one (single power supply). otherwise, the lsi will be permanently damaged. 2. in boot mode, use on-board pull-up.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 584 of 872 rej09b0325-0300 18.4 flash memory register configuration the registers * used to control the on-chip flash memory when enabled are shown in table 18.3. note: * access is prohibited to lower 16 address bits h'ff43 to h'ff46 and h'ff48 to h'ff4f. these bits are designed for the on-chip flash memory version and do not exist in the on-chip mask rom version. in the on-chip mask rom version, these bits always read 1, and writing is disabled. table 18.3 register configuration register name abbreviation r/w initial value address * 1 flash memory control register 1 flmcr1 * 5 r/w * 2 h'00 * 3 h'ff40 flash memory control register 2 flmcr2 * 5 r/w * 2 * 6 h'00 h'ff41 erase block register ebr * 5 r/w * 2 h'00 * 4 h'ff42 ram control register ramcr * 5 r/w h'f0 h'ff47 notes: 1. lower 16 bits of the address. 2. if the chip is in a mode in which the on-chip flash memory is disabled, a read will return h'00 and writes are invalid. writes are also invalid when the fwe bit in flmcr1 is not set to 1. 3. when a high level is input to the fwe pin, the initial value is h'80. 4. when a low level is input to the fwe pin, or if a high level is input and the swe bit in flmcr1 is 0, these registers are initialized to h'00. 5. flmcr1, flmcr2, ebr, and ramcr are 8-bit registers. byte access must be used on these registers (do not use word or longword access). 6. bits 6 to 0 are reserved bits but are readable/writable. 18.5 flash memory register descriptions 18.5.1 flash memory control register 1 (flmcr1) bit 76543210 fwe swe esu psu ev pv e p initial value ? * 0000000 read/write r r/w r/w r/w r/w r/w r/w r/w note: * determined by the state of the fwe pin.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 585 of 872 rej09b0325-0300 flmcr1 is an 8-bit register used for flash memory operating mode control. program-verify mode or erase-verify mode for addresses h'00000 to h'1ffff is entered by setting swe bit to 1 when fwe = 1, then setting the pv or ev bit. program mode for addresses h'00000 to h'1ffff is entered by setting swe bit to 1 when fwe = 1, then setting the psu bit, and finally setting the p bit. erase mode for addresses h'00000 to h'1ffff is entered by setting swe bit to 1 when fwe = 1, then setting the esu bit, and finally setting the e bit. flmcr1 is initialized by a reset, and in hardware standby mode and software standby mode. its initial value is h'80 when a high level is input to the fwe pin, and h'00 when a low level is input. when on-chip flash memory is disabled, a read will return h'00, and writes are invalid. set 1 to bits 6 to 0 by each bit in this register. writes are enabled only in the following cases: writes to bit swe of flmcr1 enabled when fwe = 1, to bits esu, psu, ev, and pv when fwe = 1 and swe = 1, to bit e when fwe = 1, swe = 1 and esu = 1, and to bit p when fwe = 1, swe = 1, and psu = 1. notes: 1. the programming and erase flowcharts must be followed when setting the bits in this register to prevent erroneous programming or erasing. 2. transitions are made to program mode, erase mode, program-verify mode, and erase- verify mode according to the settings in this register. when reading flash memory as normal on-chip rom, bits 6 to 0 in this register must be cleared. bit 7?flash write enable bit (fwe): sets hardware protection against flash memory programming/erasing. bit 7: fwe description 0 when a low level is input to the fwe pin (hardware-protected state) 1 when a high level is input to the fwe pin bit 6?software write enable bit (swe): enables or disables flash memory programming and erasing (applicable addresses: h'00000 to h'1ffff). set this bit when setting bits 5 to 0, bits 7 to 0 of ebr. bit 6: swe description 0 writes disabled (initial value) 1 writes enabled * [setting condition] when fwe = 1 note: * do not execute a sleep instruction while the swe bit is set to 1.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 586 of 872 rej09b0325-0300 bit 5?erase setup bit (esu): prepares for a transition to erase mode (applicable addresses: h'00000 to h'1ffff). do not set the swe, psu, ev, pv, e, or p bit at the same time. set this bit to 1 before setting bit e to 1 in flmcr1. bit 5: esu description 0 erase setup cleared (initial value) 1 erase setup [setting condition] when fwe = 1 and swe = 1 bit 4?program setup bit (psu): prepares for a transition to program mode (applicable addresses: h'00000 to h'1ffff). do not set the swe, esu, ev, pv, e, or p bit at the same time. set this bit to 1 before setting bit p to 1 in flmcr1. bit 4: psu description 0 program setup cleared (initial value) 1 program setup [setting condition] when fwe = 1 and swe = 1 bit 3?erase-verify bit (ev): selects erase-verify mode transition or clearing (applicable addresses: h'00000 to h'1ffff). do not set the swe, esu, psu, pv, e, or p bit at the same time. bit 3: ev description 0 erase-verify mode cleared (initial value) 1 transition to erase-verify mode [setting condition] when fwe = 1 and swe = 1
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 587 of 872 rej09b0325-0300 bit 2?program-verify bit (pv): selects program-verify mode transition or clearing (applicable addresses: h'00000 to h'1ffff). do not set the swe, esu, psu, ev, e, or p bit at the same time. bit 2: pv description 0 program-verify mode cleared (initial value) 1 transition to program-verify mode [setting condition] when fwe = 1 and swe = 1 bit 1?erase bit (e): selects erase mode transition or clearing (applicable addresses: h'00000 to h'1ffff). do not set the swe, esu, psu, ev, pv, or p bit at the same time. bit 1: e description 0 erase mode cleared (initial value) 1 transition to erase mode * [setting condition] when fwe = 1, swe = 1, and esu = 1 note: * do not access flash memory while the e bit is set to 1. bit 0?program bit (p): selects program mode transition or clearing (applicable addresses: h'00000 to h'1ffff). do not set the swe, psu, esu, ev, pv, or e bit at the same time. bit 0: p description 0 program mode cleared (initial value) 1 transition to program mode * [setting condition] when fwe = 1, swe = 1, and psu = 1 note: * do not access flash memory while the p bit is set.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 588 of 872 rej09b0325-0300 18.5.2 flash memory control register 2 (flmcr2) bit 76543210 fler??????? initial value00000000 read/write r r/w r/w r/w r/w r/w r/w r/w flmcr2 is an 8-bit register used for flash memory operating mode control. flmcr2 is initialized to h'00 by a reset, and in hardware standby mode and software standby mode. when the on-chip flash memory is disabled, a read will return h'00. note: bits 6 to 0 are reserved bits but are readable/writable. bit 7?flash memory error (fler): indicates that an error has occurred during an operation on flash memory (programming or erasing). when fler is set to 1, flash memory goes to the error- protection state. bit 7: fler description 0 flash memory is operating normally flash memory program/erase protection (error protection) is disabled [clearing condition] reset ( res pin or wdt reset) or hardware standby mode (initial value) 1 an error occurred during flash memory programming/erasing flash memory program/erase protection (error protection) is enabled [setting conditions] ? when flash memory is read during programming/erasing (including a vector read or instruction fetch, but excluding a read of the ram area overlapping flash memory space) ? immediately after the start of exception handling during programming/erasing (excluding reset, illegal instruction, trap instruction, and division-by-zero exception handling) ? when a sleep instruction (including software standby) is executed during programming/erasing ? when the bus is released during programming/erasing bits 6 to 0?reserved: these bits are readable/writable.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 589 of 872 rej09b0325-0300 18.5.3 erase block register (ebr) ebr is an 8-bit register that designates the flash memory block for erasure. ebr is initialized to h'00 by a reset, in hardware standby mode or software standby mode, when a high level is not input to the fwe pin, or when the swe bit in flmcr1 is 0 when a high level is applied to the fwe pin. when a bit is set in ebr, the corresponding block can be erased. other blocks are erase- protected. the blocks are erased block by block. therefore, set only one bit in ebr; do not set bits in ebr to erase two or more blocks at the same time. each bit in ebr cannot be set until the swe bit in flmcr1 is set. the flash memory block configuration is shown in table 18.4. to erase all the blocks, erase each block sequentially. 0 r/w 0 r/w 0 r/w 0 r/w 0 r/w 0 r/w 0 r/w 0 r/w initial value read/write 7 eb7 0 r 6 eb6 0 r 5 eb5 0 r 4 eb4 0 r 3 eb3 0 r 0 eb0 0 r 2 eb2 0 r 1 eb1 0 r bit initial value read/write modes 5 to 7 modes 1 to 4 bits 7 to 0?block 7 to block 0 (eb7 to eb0): setting one of these bits specifies the corresponding block (eb7 to eb0) for erasure. bits 7?0: eb7?eb0 description 0 corresponding block (eb7 to eb0) not selected (initial value) 1 corresponding block (eb7 to eb0) selected note: when not performing an erase, clear ebr to h'00.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 590 of 872 rej09b0325-0300 table 18.4 flash memory erase blocks block (size) address eb0 (1 kbyte) h'000000 ? h'0003ff eb1 (1 kbyte) h'000400 ? h'0007ff eb2 (1 kbyte) h'000800 ? h'000bff eb3 (1 kbyte) h'000c00 ? h'000fff eb4 (28 kbytes) h'001000 ? h'007fff eb5 (32 kbytes) h'008000 ? h'00ffff eb6 (32 kbytes) h'010000 ? h'017fff eb7 (32 kbytes) h'018000 ? h'01ffff 18.5.4 ram control register (ramcr) 1 ? 1 ? 1 ? 1 ? 0 r/w 0 r/w 0 r/w 0 r/w initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 rams 0 r 0 ? 0 ? 2 ram2 0 r 1 ram1 0 r bit initial value read/write reserved bits reserved bit ram2, ram1 used together with bit 3 to select a flash memory area ram select used together with bits 2 and 1 to select a flash memory area modes 5 to 7 modes 1 to 4 ramcr selects the ram area to be used when emulating real-time flash memory programming. ramcr initialized to h'f0 by a reset and in hardware standby mode. it is not initialized in software standby mode. ramcr settings should be made in user mode or user program mode. * note: * when performing flash memory emulation by ram, the rame bit in syscr must be set to 1. ram area settings are shown in table 18.5. to ensure correct operation of the emulation function, the rom for which ram emulation is performed should not be accessed immediately after this
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 591 of 872 rej09b0325-0300 register has been modified. normal execution of an access immediately after register modification is not guaranteed. bits 7 to 4?reserved: these bits always read 1. writing is disabled. bit 3?ram select (rams): specifies selection or non-selection of flash memory emulation in ram. when rams = 1, all flash memory block are program/erase-protected. bit 3: rams description 0 emulation not selected (initial value) program/erase-protection of all flash memory blocks is disabled 1 emulation selected program/erase-protection of all flash memory blocks is enabled bits 2 and 1?ram2 and ram1: these bits are used with bit 3 to reassign an area to ram (see table 18.5). bit 0?reserved: this bit is readable/writable. table 18.5 ram area setting bit 3 bit 2 bit 1 ram area rams ram2 ram1 ram emulation status h'fff000 ? h'fff3ff 0 0/1 0/1 no emulation h'000000 ? h'0003ff 1 0 0 mapping ram h'000400 ? h'0007ff 1 0 1 h'000800 ? h'000bff 1 1 0 h'000c00 ? h'000fff 1 1 1
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 592 of 872 rej09b0325-0300 rom area ram area eb0 h'000000 h'0003ff h'000400 h'0007ff h'000800 h'000bff h'ffef10 h'ffefff h'fff000 h'fff3ff h'fff400 h'ffff0f h'000c00 h'000fff eb1 mapping ram eb2 eb3 actual ram ram overlap area (h'fff000 ? h'fff3ff) rom blocks eb0 ? eb3 (h'000000 ? h'000fff) ram selection area rom selection area figure 18.6 example of rom area/ram area overlap 18.6 flash memory on-board programming modes when pins are set to on-board programming mode and a reset-start is executed, a transition is made to the on-board programming state in which program/erase/verify operations can be performed on the on-chip flash memory. there are two on-board programming modes: boot mode and user program mode. the pin settings for transition to each of these modes are shown in table 18.6. for a diagram of the transitions to the various flash memory modes, see figure 18.2. table 18.6 setting on-board programming modes mode fwe * 2 md2 * 2 md1 md0 rxd1 notes boot mode mode 5 1 * 1 0 * 1 011 * 3 0: v il mode 6 0 * 1 101 * 3 1: v ih mode 7 0 * 1 111 * 3 user program mode mode 5 1 * 1 010/1 mode 6 1 * 1 100/1 mode 7 1 * 1 110/1 notes: 1. (1) for the high-level application timing, see notes on use of boot mode. (2) in boot mode, the inverse of the md 2 setting should be input. (3) in boot mode, the mode control register (mdcr) can be used to monitor the status of modes 5, 6, and 7, in the same way as in normal mode. 2. never apply 12 v to the h8/3048f-one (single power supply). if do so, the lsi will be permanently damaged. 3. for pins rxd1 and txd1, use on-board pull-up.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 593 of 872 rej09b0325-0300 18.6.1 boot mode when boot mode is used, the flash memory programming control program must be prepared in the host beforehand. the sci channel to be used is set to asynchronous mode. when a reset-start is executed after h8/3048f-one ? s pins have been set to boot mode, the boot program built into the lsi is started and the programming control program prepared in the host is serially transmitted to the lsi via the sci. in the lsi, the programming control program received via the sci is written into the programming control program area in on-chip ram. after the transfer is completed, the programming control program is recognized (the id code is checked) if it corresponds to the h8/3048f-one. when the id code is matched, control branches to the start address of the programming control program area and the programming control program execution state is entered (flash memory programming is performed). the transferred programming control program must therefore include coding that follows the programming algorithm given later. the system configuration in boot mode is shown in figure 18.7, and the boot mode execution procedure in figure 18.8. rxd1 * txd1 * sci1 h8/3048f-one flash memory write data reception verify data transmission host on-chip ram note: * for pins rxd1 and txd1, use on-board pull-up. figure 18.7 system configuration in boot mode
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 594 of 872 rej09b0325-0300 n = n? yes no set pins to boot program mode and execute reset-start n = 1 n + 1 n transmit h'ff as error notification host transfers data (h'00) continuously at prescribed bit rate h8/3048f-one measures low period of h'00 data transmitted by host after bit rate adjustment, h8/3048f-one transmits one h'00 data byte to host to indicate end of adjustment host confirms normal reception of bit rate adjustment end indication (h'00), and transmits one h'55 data byte after receiving h'55, h8/3048f-one transmits one h'aa byte to host host transmits number of programming control program bytes (n), upper byte followed by lower byte h8/3048f-one transmits received number of bytes to host as verify data (echo-back) host transmits programming control program sequentially in byte units h8/3048f-one transmits received programming control program to host as verify data (echo-back) transfer received programming control program to on-chip ram end of transmission check flash memory data, and if data has already been written, erase all blocks execute programming control program transferred to on-chip ram start h8/3048f-one calculates bit rate and sets value in bit rate register confirm that all flash memory data has been erased * check id code at beginning of user program transfer area transmit one h'aa byte to host (mismatch) (match) note: * if a memory cell does not operate normally and cannot be erased, one h'ff byte is transmitted as an erase error indication, and the erase operation and subsequent operations are halted. figure 18.8 boot mode execution procedure
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 595 of 872 rej09b0325-0300 automatic sci bit rate adjustment start bit stop bit d0 d1 d2 d3 d4 d5 d6 d7 low period (9 bits) measured (h'00 data) high period (1 or more bits) when boot mode is initiated, h8/3048f-one measures the low period of the asynchronous sci communication data (h'00) transmitted continuously from the host. the sci transmit/receive format should be set as follows: 8-bit data, 1 stop bit, no parity. h8/3048f-one calculates the bit rate of the transmission from the host from the measured low period, and transmits one h'00 byte to the host to indicate the end of bit rate adjustment. the host should confirm that this adjustment end indication (h'00) has been received normally, and transmit one h'55 byte to h8/3048f-one. if reception cannot be performed normally, initiate boot mode again (reset), and repeat the above operations. depending on the host ? s transmission bit rate and h8/3048f-one ? s system clock frequency, there will be a discrepancy between the bit rates of the host and h8/3048f-one. set the host transfer bit rate at 4,800, 9,600 or 19,200 bps * to operate the sci properly. table 18.7 shows host transfer bit rates and system clock frequencies for which automatic adjustment of h8/3048f-one bit rate is possible. the boot program should be executed within this system clock range. table 18.7 system clock frequencies for which automatic adjustment of h8/3048f-one bit rate is possible host bit rate system clock frequency for which automatic adjustment of lsi bit rate is possible (mhz) 4800 bps 4 to 25 9,600 bps 8 to 25 19,200 bps 16 to 25 note: * use a host bit rate setting of 4800, 9600, or 19200 bps only. no other setting should be used. although the h8/3048f-one may also perform automatic bit rate adjustment with bit rate and system clock combinations other than those shown in table 18.7, a degree of error will arise between the bit rates of the host and the h8/3048f-one, and subsequent transfer will not be performed normally. therefore, only combinations of bit rate and system clock within the ranges shown in table 18.7 can be used for boot mode execution.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 596 of 872 rej09b0325-0300 on-chip ram area divisions in boot mode in boot mode, the ram area is divided into an area used by the boot program and an area to which the programming control program is transferred via the sci, as shown in figure 18.9. the boot program area cannot be used until the execution state in boot mode switches to the programming control program transferred from the host. h'ffef10 h'fff50f h'fff510 h'ffff0f programming control program area id code area (8 bytes) boot program area figure 18.9 ram areas in boot mode note: the boot program area cannot be used until a transition is made to the execution state for the programming control program transferred to ram. note also that the boot program remains in this area of the on-chip ram even after control branches to the programming control program. in boot mode in the h8/3048f-one, the contents of the 8-byte id code area shown below are checked to determine whether the program is a programming control program compatible with the h8/3048f-one. h'fff510 h'fff518 onward 40 fe 62 66 33 30 34 38 programming control program instruction codes (product id code) if an original programming control program is used in boot mode, the 8-byte id code shown above should be added at the beginning of the program.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 597 of 872 rej09b0325-0300 notes on using the boot mode 1. when this lsi comes out of reset in boot mode, it measures the low period the input at the sci ? s rxd 1 pin. the reset should end with rxd 1 high. after the reset ends, it takes about 100 states for this lsi to get ready to measure the low period of the rxd 1 input. 2. in boot mode, if any data has been written to the flash memory (if all data is not h'ff), all flash memory blocks are erased. therefore, this mode should be used for initial on-board programming, or for forced recovery if the program to be activated in user program mode is accidentally erased and user program mode cannot be executed, for example. 3. interrupts cannot be used during programming or erasing of flash memory. 4. the rxd 1 and txd 1 pins should be pulled up on the board. 5. this lsi terminates transmit and receive operations by the on-chip sci(channel 1) (by clearing the re and te bits in serial control register (scr)) before branching to the transmit data output pin. however, the adjusted bit rate is held in the bit rate register (brr). at this time, the txd 1 is in the high level output state (p9ddr p9 1 ddr=1, p9dr p9 1 dr=1). before branching to the programming control program the value of the general registers in the cpu are also undefined. therefore, the general registers must be initialized immediately after control branches to the programming control program. since the stack pointer (sp) is implicitly used during subroutine call, etc., a stack area must be specified for use by the programming control program. there are no other internal i/o registers in which the initial value is changed. 6. transition to the boot mode executes a reset-start of this lsi after setting the md 0 to md 2 , fwe, and rxd1 pins according to the mode setting conditions shown in table 18.6. at this time, this lsi latches the status of the mode pin inside the microcomputer to maintain the boot mode status at the reset clear (startup from low level to high level) timing * 1 . to clear boot mode, it is necessary to drive the fwe pin low during the reset, and then execute reset release * 1 . the following points must be noted:  before making a transition from the boot mode to the regular mode, the microcomputer boot mode must be reset by reset input via the res pin * 1 . at this time, the res pin must be hold at low level for at least 20 system clock * 2 .  do not change the input levels at the mode pins (md 2 to md 0 ) or the fwe pin while in boot mode. when making a mode transition, first enter the reset state by inputting a low level to the res pin. when a watchdog timer reset was generated in the boot mode, the microcomputer mode is not reset and the on-chip boot program is restarted regardless of the state of the mode pin.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 598 of 872 rej09b0325-0300  do not input low level to the fwe pin while the boot program is executing and when programming/erasing flash memory * 3 . 7. if the mode pins (md 2 to md 0 ), fwe pin, and rxd1 pin input levels are changed (e.g., from low level to high level) during a reset (while a low level is being input to the res pin), since the microcomputer ? s operating mode will change and the state of the address dual port and bus control output signals ( csn , rd , hwr , lwr ) changes, use of these pins as output signals during reset must be disabled outside the microcomputer. csn md2 system control unit external memory, etc. h8/3048f-one md1 md0 fwe res figure 18.10 recommended system block diagram notes: 1. the mode pin, fwe pin, and rxd1 pin input must satisfy the mode programming setup time (t mds ) relative to the reset clear timing. 2. see section 4.2.2, reset sequence and 18.11, notes on flash memory programming/erasing. the h8/3048f-one requires a minimum of 20 system clocks. 3. for notes on fwe pin high/low, see section 18.11, notes on flash memory programming/erasing. 18.6.2 user program mode when set to the user program mode, user ? s programming/erasing control program can erase and program the flash memory. therefore, on-chip flash memory on-board programming can be performed by providing a means of controlling fwe and supplying the write data on the board and providing a programming/erasing program in a part of the program area. to select this mode, activate h8/3048f-one to on-chip flash memory enable modes 5, 6, and 7 and apply a high level to the fwe pin. in this state, the peripheral functions, other than flash memory, are performed the same as in modes 5, 6, and 7.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 599 of 872 rej09b0325-0300 since the flash memory cannot be read while it is being programmed/erased, place a programming program on external memory, or transfer the programming program to ram area, and execute it in the ram. figure 18.11 shows the procedure for executing when transferred to on-chip ram. during reset start, starting from the user program mode is possible. fwe = high (user program mode) transfer programming/erasing program to ram reset start md 2 ? md 0 = 101, 110, 111 execute programming/erasing program in ram (flash memory reprogramming) input low level to fwe after swe bit clear (user program mode exit) execute user application program in flash memory 1 2 3 4 5 6 7 8 procedure the user writes a program that executes steps 3 to 8 in advance as shown below. 1. sets the mode pin to an on-chip rom enable mode (mode 5, 6, or 7). 2. starts the cpu via reset. (the cpu can also be started from the user program mode by setting the fwe pin to high level during reset; that is, during the period the res pin is a low level.) 3. transfers the programming/erasing program to ram. 4. branches to the program in ram area. 5. sets the fwe pin to a high level. * (switches to user program mode.) 6. after confirming that the fwe pin is a high level, executes the programming/erasing program in ram. this reprograms the user application program in flash memory. 7. at the end of reprograming, clears the swe bit, and exits the user program mode by switching the fwe pin from a high level to a low level. * 8. branches to, and executes, the user application program reprogrammed in flash memory. note: * for notes on fwe pin high/low, see section 18.11, notes on flash memory programming/erasing. branch to programming/erasing program in ram area figure 18.11 user program mode execution procedure (example)
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 600 of 872 rej09b0325-0300 notes: 1. normally do not apply a high level to the fwe pin. apply a high level to the fwe pin only when programming/erasing flash memory (including flash memory emulation by ram). also, while a high level is input to the fwe pin, the watchdog timer should be activated to prevent overprogramming or overerasing due to program runaway, etc. 2. when the flash memory is read normally in the user program mode, the programming/ erasing program must not be executed. bits 6 to 0 in flmcr1 must be cleared to 0. 18.7 programming/erasing flash memory a software method, using the cpu, is employed to program and erase flash memory in the on- board programming modes. there are four flash memory operating modes: program mode, erase mode, program-verify mode, and erase-verify mode. transitions to these modes are made by setting the psu, esu, p, e, pv, and ev bits in flmcr1 for addresses h'000000 to h'01ffff. the flash memory cannot be read while it is being written or erased. install the program to control flash memory programming and erasing (programming control program) in the on-chip ram or in external memory, and execute the program from there. see section 18.11, notes on flash memory programming/erasing, for points to be noted when programming or erasing the flash memory. in the following operation descriptions, wait times after setting or clearing individual bits in flmcr1 are given as parameters; for details of the wait times, see section 21.1.6, flash memory characteristics. notes: 1. operation is not guaranteed if bits swe, esu, psu, ev, pv, e, and p of flmcr1 are set/reset by a program in flash memory in the corresponding address areas. 2. when programming or erasing, set fwe to 1 (programming/erasing will not be executed if fwe = 0). 3. programming should be performed in the erased state. do not perform additional programming on previously programmed addresses.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 601 of 872 rej09b0325-0300 notes: in order to perform a normal read of flash memory, swe must be cleared to 0. also note that verify-reads can be performed during the programming/erasing process. 1. : normal mode : on-board programming mode 2. do not make a state transition by setting or clearing multiple bits simultaneously. 3. after a transition from erase mode to the erase setup state, do not enter erase mode without passing through the software programming enable state. 4. after a transition from program mode to the program setup state, do not enter program mode without passing through the software programming enable state. normal mode on-board programming mode software programming disable state erase setup state erase mode program mode erase-verify mode program setup state program-verify mode swe = 1 swe = 0 fwe = 1 fwe = 0 e = 1 e = 0 p = 1 p = 0 software programming enable state * 1 * 2 * 3 * 4 esu = 0 esu = 1 psu = 1 psu = 0 pv = 1 ev = 0 ev = 1 pv = 0 figure 18.12 state transitions caused by flmcr1 bit settings
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 602 of 872 rej09b0325-0300 18.7.1 program mode to write data or programs to flash memory, the program/program-verify flowchart shown in figure 18.13 should be followed. performing program operations according to this flowchart will enable data or programs to be written to flash memory without subjecting the device to voltage stress or sacrificing program data reliability. programming should be carried out 128 bytes at a time. the wait times after bits are set or cleared in the flash memory control register 1 (flmcr1) and the maximum number of programming operations (n) are shown in table 21.11 in section 21.1.6, flash memory characteristics. following the elapse of (t sswe ) s or more after the swe bit is set to 1 in flmcr1, 128-byte data is written consecutively to the write addresses. the lower 8 bits of the first address written to must be h'00 and h'80, 128 consecutive byte data transfers are performed. the program address and program data are latched in the flash memory. a 128-byte data transfer must be performed even if writing fewer than 128 bytes; in this case, h'ff data must be written to the extra addresses. next, the watchdog timer (wdt) is set to prevent overprogramming due to program runaway, etc. set a value greater than (t spsu + t sp + t cp + t cpsu ) s as the wdt overflow period. preparation for entering program mode (program setup) is performed next by setting the psu bit in flmcr1. the operating mode is then switched to program mode by setting the p bit in flmcr1 after the elapse of at least (t spsu ) s. the time during which the p bit is set is the flash memory programming time. make a program setting so that the time for one programming operation is within the range of (t sp ) s. the wait time after p bit setting must be changed according to the number of reprogramming loops. for details, see notes on program/program-verify procedure.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 603 of 872 rej09b0325-0300 18.7.2 program-verify mode in program-verify mode, the data written in program mode is read to check whether it has been correctly written in the flash memory. after the elapse of the given programming time, clear the p bit in flmcr1, then wait for at least (t cp ) s before clearing the psu bit to exit program mode. after exiting program mode, the watchdog timer setting is also cleared. the operating mode is then switched to program-verify mode by setting the pv bit in flmcr1. before reading in program-verify mode, a dummy write of h'ff data should be made to the addresses to be read. the dummy write should be executed after the elapse of (t spv ) s or more. when the flash memory is read in this state (verify data is read in 16-bit units), the data at the latched address is read. wait at least (t spvr ) s after the dummy write before performing this read operation. next, the originally written data is compared with the verify data, and reprogram data is computed (see figure 18.13) and transferred to ram. after verification of 128 bytes of data has been completed, exit program-verify mode, wait for at least (t cpv ) s, then determine whether 128-byte programming has finished. if reprogramming is necessary, set program mode again, and repeat the program/program-verify sequence as before. the maximum value for repetition of the program/program-verify sequence is indicated by the maximum programming count (n). leave a wait time of at least (t cswe ) s after clearing swe. notes on program/program-verify procedure 1. the program/program-verify procedure for the h8/3048f-one is a 128-byte-unit programming algorithm. in order to perform 128-byte-unit programming, the lower 8 bits of the write start address must be h'00 or h'80. 2. when performing continuous writing of 128-byte data to flash memory, byte-unit transfer should be used. 128-byte data transfer is necessary even when writing fewer than 128 bytes of data. h'ff data must be written to the extra addresses. 3. verify data is read in word units. 4. the write pulse is applied and a flash memory write executed while the p bit in flmcr1 is set. in the h8/3048f-one, write pulses should be applied as follows in the program/program- verify procedure to prevent voltage stress on the device and loss of write data reliability. a. after write pulse application, perform a verify-read in program-verify mode and apply a write pulse again for any bits read as 1 (reprogramming processing). when all the 0-write bits in the 128-byte write data are read as 0 in the verify-read operation, the program/program-verify procedure is completed. in the h8/3048f-one, the number of
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 604 of 872 rej09b0325-0300 loops in reprogramming processing is guaranteed not to exceed the maximum value of the maximum programming count (n). b. after write pulse application, a verify-read is performed in program-verify mode, and programming is judged to have been completed for bits read as 0. the following processing is necessary for programmed bits. when programming is completed at an early stage in the program/program-verify procedure: if programming is completed in the 1st to 6th reprogramming processing loop, additional programming should be performed on the relevant bits. additional programming should only be performed on bits which first return 0 in a verify-read in certain reprogramming processing. when programming is completed at a late stage in the program/program-verify procedure: if programming is completed in the 7th or later reprogramming processing loop, additional programming is not necessary for the relevant bits. c. if programming of other bits is incomplete in the 128 bytes, reprogramming process should be executed. if a bit for which programming has been judged to be completed is read as 1 in a subsequent verify-read, a write pulse should again be applied to that bit. 5. the period for which the p bit in flmcr1 is set (the write pulse width) should be changed according to the degree of progress through the program/program-verify procedure. for detailed wait time specifications, see section 21.1.6, flash memory characteristics. table 18.8 wait time after p bit setting item symbol conditions symbol t sp when reprogramming loop count (n) is 1 to 6 t sp 30 when reprogramming loop count (n) is 7 or more t sp 200 wait time after p bit setting in case of additional programming processing * t sp 10 note: * additional programming processing is necessary only when the reprogramming loop count (n) is 1 to 6. 6. the program/program-verify flowchart for the h8/3048f-one is shown in figure 18.13. to cover the points noted above, bits on which reprogramming processing is to be executed, and bits on which additional programming is to be executed, must be determined as shown below. since reprogram data and additional-programming data vary according to the progress of the programming procedure, it is recommended that the following data storage areas (128 bytes each) be provided in ram.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 605 of 872 rej09b0325-0300 table 18.9 reprogram data computation table (d) result of verify-read after write pulse application (v) (x) result of operation comments 0 0 1 programming completed: reprogramming processing not to be executed 0 1 0 programming incomplete: reprogramming processing to be executed 10 1 ? 1 1 1 still in erased state: no action legend: source data of bits on which programming is executed: (d) data of bits on which reprogramming is executed: (x) table 18.10 additional-programming data computation table x result of verify-read after write pulse application (v) (y) result of operation comments 0 0 0 programming by write pulse application judged to be completed: additional programming processing to be executed 0 1 1 programming by write pulse application incomplete: additional programming processing not to be executed 1 0 1 programming already completed: additional programming processing not to be executed 1 1 1 still in erased state: no action legend: data of bits on which additional programming is executed: (y) data of bits on which reprogramming is executed in a certain reprogramming loop: (x') 7. it is necessary to execute additional programming processing during the course of the h8/3048f-one program/program-verify procedure. however, once 128-byte-unit programming is finished, additional programming should not be carried out on the same address area. when executing reprogramming, an erase must be executed first. note that normal operation of reads, etc., is not guaranteed if additional programming is performed on addresses for which a program/program-verify operation has finished.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 606 of 872 rej09b0325-0300 start end of programming set swe bit in flmcr1 start of programming write pulse application subroutine wait (t sswe ) s sub-routine write pulse end sub set psu in flmcr1 wdt enable disable wdt number of writes n 1 2 3 4 5 6 7 8 9 10 11 12 13 998 999 1000 note: 6. write pulse width write time (tsp) sec 30 30 30 30 30 30 200 200 200 200 200 200 200 200 200 200 wait (t spsu ) s set p bit in flmcr1 wait (t sp ) s clear p bit in flmcr1 wait (t cp ) s clear psu bit in flmcr1 wait (t cpsu ) s n= 1 m= 0 ng ng ng ng ok ok ok wait (t spv ) s wait (t spvr ) s * 2 * 7 * 7 * 4 * 7 * 7 start of programming programming halted * 5 * 7 * 7 * 7 * 1 wait (t cpv ) s write pulse sub-routine-call set pv bit in flmcr1 h'ff dummy write to verify address read verify data write data = verify data? * 4 * 3 * 7 * 7 * 7 * 1 transfer reprogram data to reprogram data area reprogram data computation * 4 transfer additional-programming data to additional-programming data area additional-programming data computation clear pv bit in flmcr1 clear swe bit in flmcr1 m = 1 reprogram see note 6 for pulse width m = 0 ? increment address programming failure ok clear swe bit in flmcr1 wait (t cswe ) s ng ok 6 n? ng ok 6 n ? wait (t cswe ) s n n? n n + 1 original data (d) verify data (v) reprogram data (x) comments programming completed still in erased state; no action programming incomplete; reprogram note: use a 10 s write pulse for additional programming. write 128-byte data in ram reprogram data area consecutively to flash memory ram program data storage area (128 bytes) reprogram data storage area (128 bytes) additional-programming data storage area (128 bytes) store 128-byte program data in program data area and reprogram data area write pulse (additional programming) sub-routine-call 128-byte data verification completed? successively write 128-byte data from additional- programming data area in ram to flash memory reprogram data computation table reprogram data (x') verify data (v) additional- programming data (y) 1 1 1 1 0 1 0 0 0 0 1 1 comments additional programming to be executed additional programming not to be executed additional programming not to be executed additional programming not to be executed 0 1 1 1 0 1 0 1 0 0 1 1 additional-programming data computation table perform programming in the erased state. do not perform additional programming on previously programmed addresses. notes: 1. data transfer is performed by byte transfer. the lower 8 bits of the first address written to must be h'00 or h'80. a 128-byte data transfer must be performed even if writing fewer than 128 bytes; in this case, h'ff data must be written to t he extra addresses. 2. verify data is read in 16-bit (word) units. 3. reprogram data is determined by the operation shown in the table below (comparison between the data stored in the program d ata area and the verify data). bits for which the reprogram data is 0 are programmed in the next reprogramming loop. therefore, even bits for which programmin g has been completed will be subjected to programming once again if the result of the subsequent verify operation is ng. 4. a 128-byte area for storing program data, a 128-byte area for storing reprogram data, and a 128-byte area for storing addit ional data must be provided in ram. the contents of the reprogram data area and additional data area are modified as programming proceeds. 5. a write pulse of 30 s or 200 s is applied according to the progress of the programming operation. see note 6 for details of the pulse widths. when writing o f additional-programming data is executed, a 10 s write pulse should be applied. reprogram data x' means reprogram data when the write pulse is applied. 7. the wait times and value of n are shown in section 21.1.6, flash memory characteristics. figure 18.13 program/program-verify flowchart (128-byte programming)
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 607 of 872 rej09b0325-0300 18.7.3 erase mode to erase an individual flash memory block, follow the flowchart for erasing one block (single- block erase) shown in figure 18.14. the wait times after bits are set or cleared in the flash memory control register 1 (flmcr1) and the maximum number of erase operations (n) are shown in table 21.11 in section 21.1.6, flash memory characteristics. to erase flash memory contents, make a 1-bit setting for the flash memory area to be erased in erase block register (ebr1) at least (t sswe ) s after setting the swe bit to 1 in flmcr1. next, the watchdog timer (wdt) is set to prevent overerasing due to program runaway, etc. set a value greater than (t se ) ms + (t sesu + t ce + t cesu ) s as the wdt overflow period. preparation for entering erase mode (erase setup) is performed next by setting the esu bit in flmcr1. the operating mode is then switched to erase mode by setting the e bit in flmcr1 after the elapse of at least (t sesu ) s. the time during which the e bit is set is the flash memory erase time. ensure that the erase time does not exceed (t se ) ms. note: with flash memory erasing, preprogramming (setting all memory data in the memory to be erased to all 0) is not necessary before starting the erase procedure. 18.7.4 erase-verify mode in erase-verify mode, data is read after memory has been erased to check whether it has been correctly erased. after the elapse of the fixed erase time, clear the e bit in flmcr1, then wait for at least (t ce ) s before clearing the esu bit to exit erase mode. after exiting erase mode, the watchdog timer setting is also cleared. the operating mode is then switched to erase-verify mode by setting the ev bit in flmcr1. before reading in erase-verify mode, a dummy write of h'ff data should be made to the addresses to be read. the dummy write should be executed after the elapse of (t sev ) s or more. when the flash memory is read in this state (verify data is read in 16-bit units), the data at the latched address is read. wait at least (t sevr ) s after the dummy write before performing this read operation. if the read data has been erased (all 1), a dummy write is performed to the next address, and erase-verify is performed. if the read data is unerased, set erase mode again, and repeat the erase/erase-verify sequence as before. the maximum value for repetition of the erase/erase-verify sequence is indicated by the maximum erase count (n). when verification is completed, exit erase-verify mode, and wait for at least (t cev ) s. if erasure has been completed on all the erase blocks, clear bit swe1 in flmcr1, and leave a wait time of at least (t cswe ) s.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 608 of 872 rej09b0325-0300 if erasing multiple blocks, set a single bit in ebr for the next block to be erased, and repeat the erase/erase-verify sequence as before. end of erasing start set swe bit in flmcr1 set esu bit in flmcr1 set e bit in flmcr1 wait (t sswe ) s wait (t sesu ) s n = 1 set ebr enable wdt * 3, * 4 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 wait (t se ) ms wait (t ce ) s wait (t cesu ) s wait (t sev ) s set block start address as verify address wait (t sevr ) s * 2 wait (t cev ) s start of erase clear e bit in flmcr1 clear esu bit in flmcr1 set ev bit in flmcr1 h'ff dummy write to verify address read verify data clear ev bit in flmcr1 wait (t cev ) s clear ev bit in flmcr1 clear swe bit in flmcr1 disable wdt erase halted * 1 verify data = all 1s? last address of block? erase failure clear swe bit in flmcr1 n n? no no no yes yes yes n n + 1 increment address wait (t cswe ) s wait (t cswe ) s notes: 1. prewriting (setting erase block data to all 0s) is not necessary. 2. verify data is read in 16-bit (word) units. 3. make only a single-bit specification in the erase block register (ebr). two or more bits must not be set simultaneously. 4. erasing is performed in block units. to erase multiple blocks, each block must be erased in turn. 5. the wait times and the value of n are shown in section 21.1.6, flash memory characteristics. perform erasing in block units. figure 18.14 erase/erase-verify flowchart (single-block erasing)
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 609 of 872 rej09b0325-0300 18.8 flash memory protection there are three kinds of flash memory program/erase protection: hardware protection, software protection, and error protection. 18.8.1 hardware protection hardware protection refers to a state in which programming/erasing of flash memory is forcibly disabled or aborted. hardware protection is reset by settings in flash memory control register 1 (flmcr1), and erase block register (ebr). in the error-protected state, the flmcr1, flmcr2, and ebr settings are retained; the p and e bits can be set, but a transition is not made to program mode or erase mode. (see table 18.11.)
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 610 of 872 rej09b0325-0300 table 18.11 hardware protection functions item description program erase verify fwe pin protection ? when a low level is input to the fwe pin, flmcr1, and ebr are initialized, and the program/erase-protected state is entered. no * 1 no * 3 no reset/ standby protection ? in a reset (including a wdt overflow reset) and in standby mode, flmcr1, flmcr2, and ebr are initialized, and the program/erase-protected state is entered. ? in a reset via the res pin, the reset state is not entered unless the res pin is held low until oscillation stabilizes after powering on. in the case of a reset during operation, hold the res pin low for the res pulse width specified in the ac characteristics section * 4 . no no * 3 no error protection ? when a microcomputer operation error (error generation (fler = 1)) was detected while flash memory was being programmed/erased, error protection is enabled. at this time, the flmcr1 and ebr settings are held, but programming/ erasing is aborted at the time the error was generated. error protection is released only by a reset via the res pin or a wdt reset, or in the hardware standby mode. no no * 3 yes * 2 notes: 1. excluding a ram area overlapping flash memory. 2. it is possible to perform a program-verify operation on the 128 bytes being programmed, or an erase-verify operation on the block being erased. 3. all blocks are unerasable and block-by-block specification is not possible. 4. see section 4.2.2, reset sequence, and section 18.11, notes on flash memory programming/erasing. the h8/3048f-one requires at least 20 system clocks for a reset period during operation.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 611 of 872 rej09b0325-0300 18.8.2 software protection software protection can be implemented by setting, erase block register (ebr) and the rams bit in the ram control register (ramcr). when software protection is in effect, setting the p or e bit in flash memory control register 1 (flmcr1) does not cause a transition to program mode or erase mode. (see table 18.12.) table 18.12 software protection functions item description program erase verify block specification protection ? erase protection can be set for individual blocks by settings in erase block register (ebr) * 2 . however, programming protection is disabled. ? setting ebr to h'00 places all blocks in the erase-protected state. ? no yes emulation protection ? setting the rams bit to 1 in the ram control register (ramcr) places all blocks in the program/erase-protected state. no * 1 no * 3 yes notes: 1. a ram area overlapping flash memory can be written to. 2. when not erasing, clear all ebr bits to 0. 3. all blocks are unerasable and block-by-block specification is not possible.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 612 of 872 rej09b0325-0300 18.8.3 error protection in error protection, an error is detected when h8/3048f-one runaway occurs during flash memory programming/erasing * 1 , or operation is not performed in accordance with the program/erase algorithm, and the program/erase operation is aborted. aborting the program/erase operation prevents damage to the flash memory due to overprogramming or overerasing. if the h8/3048f-one malfunctions during flash memory programming/erasing, the fler bit is set to 1 in flmcr2 and the error protection state is entered. the flmcr1, flmcr2, ebr settings * 3 are retained, but program mode or erase mode is aborted at the point at which the error occurred. program mode or erase mode cannot be re-entered by re-setting the p, e bit. however, pv, ev bit setting is enabled, and a transition can be made to verify mode * 2 . fler bit setting conditions are as follows: 1. when the flash memory of the relevant address area is read during programming/erasing (including vector read and instruction fetch) 2. immediately after exception handling (excluding an illegal reset or trap instruction and exception handling at zero division) during programming/erasing 3. when a sleep instruction (including software standby) is executed during programming/erasing 4. when the cpu releases the bus to the dmac, refresh controller, and external bus master during programming/erasing error protection is released only by a reset ( res pin or wdt reset) and in hardware standby mode. notes: 1. state in which the p bit or e bit in flmcr1 is set to 1. note that nmi input is disabled in this state. 2. it is possible to perform a program-verify operation on the 128 bytes being programmed, or an erase-verify on the block being erased. 3. flmcr1 and ebr can be written to. however, the registers are initialized if a transition is made to software standby mode while in the error-protected state.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 613 of 872 rej09b0325-0300 rd vf pr er fler = 0 error occurrence wdt reset, res = 0 or stby = 0 wdt reset, res = 0 or stby = 0 rd vf pr er init fler = 0 program mode erase mode reset or standby (hardware protection) rd vf pr er fler = 1 rd vf pr er init fler = 1 error protection mode error protection mode (software standby) software standby mode flmcr1, ebr initialization state flmcr1, flmcr2, ebr initialization state software standby mode release rd: memory read possible vf: verify-read possible pr: programming possible er: erasing possible legend: rd : memory read not possible vf : verify-read not possible pr : programming not possible er : erasing not possible init: register initialization state wdt reset, res = 0 or stby = 0 error occurrence (software standby) figure 18.15 flash memory state transitions (when high level is applied to fwe pin in mode 5, 6, and 7 (on-chip rom enabled)) the error protection function is invalid for abnormal operations other than the fler bit setting conditions. also, if a certain time has elapsed before this protection state is entered, damage may already have been caused to the flash memory. consequently, this function cannot provide complete protection against damage to flash memory. to prevent such abnormal operations, therefore, it is necessary to ensure correct operation in accordance with the program/erase algorithm, with the flash write enable (fwe) voltage applied, and to conduct constant monitoring for mcu errors, internally and externally, using the watchdog timer or other means. there may also be cases where the flash memory is in an erroneous programming or erroneous erasing state at the point of transition to this protection mode, or where programming or erasing is not properly carried out because of an abort. in cases such as these, a forced recovery (program rewrite) must be executed using boot mode. however, it may also happen that boot mode cannot be normally initiated because of overprogramming or overerasing.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 614 of 872 rej09b0325-0300 18.8.4 nmi input disable conditions while flash memory is being programmed/erased (p bit or e bit in flmcr1 is set) and the boot program is executing in the boot mode * 1 , all interrupts including nmi input must be disabled because the programming/erasing have priority. this is done to avoid the following operation states: 1. generation of an interrupt during programming/erasing violates the program/erase algorithms and normal operation can not longer be assured. 2. vector-read cannot be carried out normally * 2 during interrupt exception handling during programming/erasing and the microcomputer runs away as a result. 3. if an interrupt is generated during boot program execution, the normal boot mode sequence cannot be executed. with above reasons, there are conditions that exceptionally disable nmi inputs only in the on- board programming mode. however, this does not assure normal programming/erasing and microcomputer operation. thus, when the flash memory is programmed/erased, all interrupt requests (exception handling and bus release), including nmi, inside and outside the microcomputer, must be disabled. nmi interrupt is also disabled in the error-protected state and when the p bit or e bit in flmcr1 is retained during flash memory emulation by ram. notes: 1. indicates the period up to branching to the on-chip ram boot program area (h'ffef10). (this branch occurs immediately after programming control program transfer was completed.) therefore, after branching to ram area, nmi input is enabled in states other than the program/erase state. thus, interrupt requests inside and outside the microcomputer must be disabled until initial writing by programming control program (writing of vector table and nmi processing program, etc.) is completed. 2. in this case, vector read is not performed normally for the following two reasons:  the correct value cannot be read even by reading the flash memory during programming/erasing (p bit or e bit in flmcr1 is set). (value is undefined.)  if a value has not yet been written to the interrupt vector table, interrupt exception handling will not be performed correctly.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 615 of 872 rej09b0325-0300 18.9 flash memory emulation in ram as flash memory programming and erasing takes time, it may be difficult to carry out tuning by writing parameters and other data in real time. in this case, real-time programming of flash memory can be emulated by overlapping part of ram (h'fff000 ? h'fff3ff) onto a small block area in flash memory. this ram area change is executed by means of bits 3 to 1 in the ram control register (ramcr). after the ram area change, access is possible both from the area overlapped onto flash memory and from the original area (h'fff000 ? h'fff3ff). for details of ramcr and the ram area setting method, see section 18.5.4, ram control register (ramcr). example of emulation of real-time flash memory programming in the following example, ram area h'fff000 ? h'fff3ff is overlapped onto flash memory area eb2 (h'000800 ? h'000bff). h'000000 h'000800 h'ffef10 h'fff000 h'ffefff h'fff3ff h'fff400 h'ffff0f h'000bff h'000fff eb2 area flash memory space on-chip ram area block area * (mapping ram area) overlapping ram (actual ram area) procedure: 1. part of ram (h'fff000 ? h'fff3ff) is overlapped onto the area (eb2) requiring real-time programming. (ramcr bits 3 ? 1 are set to 1, 1, 0, and the flash memory area to be overlapped (eb2) is selected.) 2. real-time programming is performed using the overlapping ram. 3. the programmed data is checked, then ram overlapping is cleared. (rams bit is cleared.) 4. the data written in ram area h'fff000 ? h'fff3ff is written to flash memory space. note: * when part of ram (h'fff000 ? h'fff3ff) is overlapped onto a flash memory small block area, the flash memory in the overlapped area cannot be accessed. it can be accessed when the overlapping is cleared. figure 18.16 example of ram overlap operation
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 616 of 872 rej09b0325-0300 notes on using the emulation function by ram 1. when the rams bit is set to 1, program/erase protection is enabled for all blocks regardless of the value of ram2 and ram1 (emulation protection). in this state, setting the p or e bit in flash memory control register 1 (flmcr1), will not cause a transition to program mode or erase mode. when actually programming or erasing a flash memory area, the rams bit should be cleared to 0. 2. a ram area cannot be erased by execution of software in accordance with the erase algorithm while flash memory emulation in ram is being used. 3. block area eb0 includes the vector table. when performing ram emulation, the vector table is needed by the overlap ram. 4. flash write enable (fwe) application and releasing as in on-board programming mode, care is required when applying and releasing fwe to prevent erroneous programming or erasing. to prevent erroneous programming and erasing due to program runaway during fwe application, in particular, the watchdog timer should be set when the psu, p, esu, or e bit in flmcr1 is set to 1, even while the emulation function is being used. for details, see section 18.11, notes on flash memory programming/erasing. 5. prohibited conditions of nmi input when the emulation function is used, nmi input is prohibited when the p bit or e bit in flmcr1 is set to 1, in the same way as with normal programming and erasing. the p and e bits are cleared by a reset (including a watchdog timer reset), in standby mode, when a high level is not being input to the fwe pin, or when the swe bit in flmcr1 is 0, while a high level is being input to the fwe pin. 18.10 flash memory prom mode the h8/3048f-one has a prom mode as well as the on-board programming modes for programming and erasing flash memory. in prom mode, the on-chip rom can be freely programmed using a general-purpose prom writer that supports the renesas technology microcomputer device type with 128-kbyte on-chip flash memory.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 617 of 872 rej09b0325-0300 18.10.1 socket adapters and memory map in prom mode using a prom writer, memory reading (verification) and writing and flash memory initialization (total erasure) can be performed. for these operations, a special socket adapter is mounted in the prom writer. the socket adapter product codes are given in table 18.13 * . in the h8/3048f-one prom mode, only the socket adapters shown in this table should be used. table 18.13 h8/3048f-one socket adapter product codes product code package socket adapter product code * manufacturer hd64f3048bf me3064eshf1h minato electronics hd64f3048bvf 100-pin qfp (fp-100b) me3024eshf1h hd64f3048bte me3064esnf1h hd64f3048bvte 100-pin tqfp (tfp-100b) me3024esnf1h hd64f3048bf hf306bq100d4001 data io japan hd64f3048bvf 100-pin qfp (fp-100b) hf302bq100d4001 hd64f3048bte hf306bt100d4001 hd64f3048bvte 100-pin tqfp (tfp-100b) hf302bt100d4001 note: * use of the wrong socket adapter may destroy the chip. figure 18.17 shows the memory map in prom mode. h'00000 prom mode h'1ffff h'000000 mcu mode h8/3048f-one h'01ffff on-chip rom figure 18.17 memory map in prom mode
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 618 of 872 rej09b0325-0300 18.10.2 notes on use of prom mode 1. a write to a 128-byte programming unit in prom mode should be performed once only. erasing must be carried out before reprogramming an address that has already been programmed. 2. when using a prom writer to reprogram a device on which on-board programming/erasing has been performed, it is recommended that erasing be carried out before executing programming. 3. the memory is initially in the erased state when the device is shipped by renesas. for samples for which the erasure history is unknown, it is recommended that erasing be executed to check and correct the initialization (erase) level. 4. the h8/3048f-one does not support a product identification mode as used with general- purpose eproms, and therefore the device name cannot be set automatically in the prom writer. 5. refer to the instruction manual provided with the socket adapter, or other relevant documentation, for information on prom writers and associated program versions that are compatible with the prom mode of the h8/3048f-one. 6. select a renesas technology 128 kbytes flash memory on-board microcomputer device type. if hn28f101 is selected, the lsi may be permanently damaged.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 619 of 872 rej09b0325-0300 18.11 notes on flash memory programming/erasing the following describes notes when using the on-board programming mode, ram emulation function, and prom mode. 1. program/erase with the specified voltage and timing. applied voltages in excess of the rating can permanently damage the device. note that the pins fwe, v pp , and md2 have different absolute maximum ratings between the h8/3048f-one (single power supply) and h8/3048f (dual power supply) models. use a prom writer that supports the renesas technology 128 kbytes flash memory on-board microcomputer device type. do not select the hn28f101 as the prom writer. otherwise, 12 v will be applied to the fwe pin and this will permanently damage h8/3048f-one. 2. notes on powering on/powering off (see figures 18.18 to 18.20) input a high level to the fwe pin after verifying vcc. before turning off vcc, set the fwe pin to a low level. when powering on and powering off the vcc power supply, fix the fwe pin low and set the flash memory to the hardware protection mode. be sure that the powering on and powering off timing is satisfied even when the power is turned off and back on in the event of a power interruption, etc. if this timing is not satisfied, microcomputer runaway, etc., may cause overprogramming or overerasing and the memory cells may not operate normally. 3. notes on fwe pin high/low switching (see figures 18.18 to 18.20) input fwe in the state microcomputer operation is verified. if the microcomputer does not satisfy the operation confirmation state, fix the fwe pin low to set the protection mode. to prevent erroneous programming/erasing of flash memory, note the following in fwe pin high/low switching: a. apply an input to the fwe pin after the vcc voltage has stabilized within the rated voltage. if an input is applied to the fwe pin when the microcomputer vcc voltage does not satisfy the rated voltage, flash memory may be erroneously programmed or erased because the microcomputer is in the unconfirmed state. b. apply an input to the fwe pin when the oscillation has stabilized (after the oscillation stabilization time). when turning on the vcc power, apply an input to the fwe pin after holding the res pin at a low level during the oscillation stabilization time. do not apply an input to the fwe pin when oscillation is stopped or unstable.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 620 of 872 rej09b0325-0300 c. in the boot mode, perform fwe pin high/low switching during reset. in transition to the boot mode, input fwe = high level and set md 2 to md 0 and rxd1 pins while the res input is low. at this time, the fwe, md 2 to md 0 , and rxd1 inputs must satisfy the mode programming setup time (t mds ) relative to the reset clear timing. the mode programming setup time is necessary for res reset timing even in transition from the boot mode to another mode. in reset during operation, the res pin must be held at a low level for at least 20 system clocks. d. in the user program mode, fwe = high/low switching is possible regardless of the res input. fwe input switching is also possible during program execution on flash memory. e. apply an input to fwe when the program is not running away. when applying an input to the fwe pin, the program execution state must be supervised using a watchdog timer, etc. f. release fwe pin input only when the swe, esu, psu, ev, pv, e, and p bits in flmcr1 are cleared. do not erroneously set any of bits swe, esu, psu, ev, pv, e, or p when applying or releasing fwe. 4. do not input a constant high level to the fwe pin. to prevent erroneous programming/erasing in the event of program runaway, etc., input a high level to the fwe pin only when programming/erasing flash memory (including flash memory emulation by ram). avoid system configurations that constantly input a high level to the fwe pin. handle program runaway, etc. by starting the watchdog timer so that flash memory is not overprogrammed/overerased even while a high level is input to the fwe pin. 5. program/erase the flash memory in accordance with the recommended algorithms. the recommended algorithms can program/erase the flash memory without applying voltage stress to the device or sacrificing the reliability of the program data. when setting the p and e bits in flmcr1, set the watchdog timer for program runaway, etc. accesses to flash memory by means of an mov instruction, etc., are prohibited while bit p or bit e is set. 6. do not set/clear the swe bit while a program is executing on flash memory. before performing flash memory program execution or data read, clear the swe bit. if the swe bit is set, the flash data can be reprogrammed, but flash memory cannot be accessed for purposes other than verify (verify during programming/erase).
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 621 of 872 rej09b0325-0300 similarly perform flash memory program execution and data read after clearing the swe bit even when using the ram emulation function with a high level input to the fwe pin. however, ram area that overlaps flash memory space can be read/programmed whether the swe bit is set or cleared. after the swe bit is cleared, waiting time is required. for details, refer to table 21.11 in section 21.1.6, flash memory characteristics. 7. do not use an interrupt during flash memory programming or erasing. since programming/erase operations (including emulation by ram) have priority when a high level is input to the fwe pin, disable all interrupt requests, including nmi. the bus release should also be disabled. 8. do not perform additional programming. reprogram flash memory after erasing. with on-board programming, program to 128-byte programming unit blocks one time only. erase all the programming unit blocks before reprogramming. 9. before programming, check that the chip is correctly mounted in the prom programmer. overcurrent damage to the device can result if the index marks on the prom programmer socket, socket adapter, and chip are not correctly aligned. 10. do not touch the socket adapter or chip during programming. touching either of these can cause contact faults and write errors. 11. a wait time of 100 s or more is necessary when performing a read after a transition to normal mode from program, erase, or verify mode. 12. use byte access on the registers that control the flash memory (flmcr1, flmcr2, ebr, and ramcr).
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 622 of 872 rej09b0325-0300 flash memory access disabled period (x: wait time after swe setting, y: wait time after swe clearing) * 2 flash memory reprogrammable period (flash memory program execution and data read, other than verify, are disabled.) notes: v cc fwe t osc1 min 0 s min 0 s t mds t mds md 2 to md 0 * 1 , rxd1 * 3 res swe bit swe set swe clear programming and erase possible wait time: x wait time: y 1. always fix the level by pulling down or pulling up the mode pins (md 2 to md 0 ) until powering off, except for mode switching. 2. see section 21.1.6, flash memory characteristics. 3. for pins rxd1 and txd1, use on-board pull-up. figure 18.18 powering on/off timing (boot mode)
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 623 of 872 rej09b0325-0300 flash memory access disabled period (x: wait time after swe setting, y: wait time after swe clearing) * 2 flash memory reprogrammable period (flash memory program execution and data read, other than verify, are disabled.) 1. always fix the level by pulling down or pulling up the mode pins (md 2 to md 0 ) up to powering off, except for mode switching. 2. see section 21.1.6, flash memory characteristics. notes: v cc fwe t osc1 min 0 s t mds md 2 to md 0 * 1 res swe bit swe set swe clear programming and erase possible wait time: x wait time: y figure 18.19 powering on/off timing (user program mode)
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 624 of 872 rej09b0325-0300 flash memory access disabled time (x: wait time after swe setting, y: wait time after swe clearing) * 3 flash memory reprogammable period (flash memory program execution and data read, other than verify, are disabled.) v cc fwe t osc1 min 0 s t mds t mds t mds t resw md 2 to md 0 , rxd1 * 4 res swe bit mode switching * 1 mode switching * 1 boot mode user mode user mode user program mode user program mode swe set swe clear programming and erase possible wait time: x wait time: y programming and erase possible wait time: x wait time: y programming and erase possible wait time: x programming and erase possible wait time: x wait time: y * 2 notes: 1. in transition to the boot mode and transition from the boot mode to another mode, mode switching via res input is necessary. during this switching period (period during which a low level is input to the res pin),the state of the address dual port and bus control output signals ( csn , as , rd , wr ) changes. therefore, do not use these pins as output signals during this switching period. 2. when making a transition from the boot mode to another mode, the mode programming setup time t mds relative to the res clear timing is necessary. 3. see section 21.1.6, flash memory characteristics. 4. for pin rxd1, use on-board pull-up. figure 18.20 mode transition timing (example: boot mode user mode ? ? ? ? user program mode)
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 625 of 872 rej09b0325-0300 18.12 mask rom (h8/3048b mask rom version) overviews 18.12.1 block diagram figure 18.21 shows a block diagram of the rom. h'00000 h'00002 h'1fffe h'00001 h'00003 h'1ffff internal data bus (upper 8 bits) internal data bus (lower 8 bits) on-chip rom even addresses odd addresses figure 18.21 rom block diagram (h8/3048b mask rom version)
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 626 of 872 rej09b0325-0300 18.13 notes on ordering mask rom version chips when ordering h8/3048b with mask rom, note the following. 1. when ordering by means of an eprom, use a 128-kbyte one. 2. fill all unused addresses with h'ff and order the same rom data size as for the 128-kbyte version. this applies to ordering by means of an eprom and by means of data transmission. h'00000 unused area * note: * write h'ff data in all addresses in this area. hd6433048b (rom: 128 kbytes) addresses: h'00000 ? 1ffff h'1ffff figure 18.22 mask rom addresses and data 3. the flash memory control registers (flmcr, ebr, ramcr, flmsr, flmcr1, flmcr2, ebr1, and ebr2)used by the versions with on-chip flash memory are not provided in the mask rom versions. reading the corresponding addresses in a mask rom version will always return 1s, and writes to these addresses are disabled. this must be borne in mind when switching from a flash memory version to a mask rom version.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 627 of 872 rej09b0325-0300 18.14 notes when converting the f-ztat (single power supply) application software to the mask-rom versions please note the following when converting the f-ztat (single power supply) application software to the mask-rom versions. the values read from the internal registers (refer to appendix b, internal i/o register, table b.1) for the f-ztat (single power supply) version differ as follows. status register bit f-ztat (single power supply) version mask-rom version flmcr1 fwe 0: application software running 1: programming 0: is not read out 1: application software running note: this difference applies to all the f-ztat (single power supply) versions and all the mask- rom versions that have different rom size.
section 18 rom (h8/3048f-one: single power supply, h8/3048b mask rom version) rev. 3.00 sep 27, 2006 page 628 of 872 rej09b0325-0300
section 19 clock pulse generator rev. 3.00 sep 27, 2006 page 629 of 872 rej09b0325-0300 section 19 clock pulse generator 19.1 overview the h8/3048b group has a built-in clock pulse generator (cpg) that generates the system clock ( ) and other internal clock signals ( /2 to /4096). after duty adjustment, a frequency divider divides the clock frequency to generate the system clock ( ). the system clock is output at the pin * 1 and furnished as a master clock to prescalers that supply clock signals to the on-chip supporting modules. frequency division ratios of 1/1, 1/2, 1/4, and 1/8 can be selected for the frequency divider by settings in a division control register (divcr). power consumption in the chip is reduced in almost direct proportion to the frequency division ratio * 2 . notes: 1. usage of the pin differs depending on the chip operating mode and the pstop bit setting in the module standby control register (mstcr). for details, see section 20.7, system clock output disabling function. 2. the division ratio of the frequency divider can be changed dynamically during operation. the clock output at the pin also changes when the division ratio is changed. the frequency output at the pin is shown below. = extal n where, extal: frequency of crystal resonator or external clock signal n: frequency division ratio (n = 1/1, 1/2, 1/4, or 1/8)
section 19 clock pulse generator rev. 3.00 sep 27, 2006 page 630 of 872 rej09b0325-0300 19.1.1 block diagram figure 19.1 shows a block diagram of the clock pulse generator. xtal extal cpg /2 to /4096 oscillator duty adjustment circuit frequency divider division control register prescalers data bus figure 19.1 block diagram of clock pulse generator 19.2 oscillator circuit clock pulses can be supplied by connecting a crystal resonator, or by input of an external clock signal. 19.2.1 connecting a crystal resonator circuit configuration a crystal resonator can be connected as in the example in figure 19.2. the damping resistance rd should be selected according to table 19.1, and external capacitance c l1 or c l2 to table 19.2. an at-cut parallel-resonance crystal should be used.
section 19 clock pulse generator rev. 3.00 sep 27, 2006 page 631 of 872 rej09b0325-0300 extal xtal c l1 c l2 rd figure 19.2 connection of crystal resonator (example) if a crystal resonator with a frequency higher than 20 mhz in the case of the 5 v version, or 13 mhz in the case of the 3 v version, is connected, the external load capacitance values in table 19.2 should not exceed 10 [pf]. also, in order to improve the accuracy of the oscillation frequency, a thorough study of oscillation matching evaluation, etc., should be carried out when deciding the circuit constants. table 19.1 damping resistance value frequency f (mhz) damping resistance value 22 < < < < f 44 < < < < f 88 < < < < f 10 10 < < < < f 13 13 < < < < f 16 16 < < < < f 18 18 < < < < f 25 rd ( ? ? ? ? ) h8/3048b group 1 k 500 200 0 0 0 0 0 note: a crystal resonator between 2 mhz and 25 mhz can be used. if the chip is to be operated at less than 2 mhz, the on-chip frequency divider should be used. (a crystal resonator of less than 2 mhz cannot be used.) table 19.2 external capacitance values external capacitance value 5 v version 3 v version frequency f (mhz) 20 < f 25 2 f 20 2 f 13 13 < f 25 c l1 = c l2 (pf) 10 10 to 22 10 to 22 10
section 19 clock pulse generator rev. 3.00 sep 27, 2006 page 632 of 872 rej09b0325-0300 crystal resonator figure 19.3 shows an equivalent circuit of the crystal resonator. the crystal resonator should have the characteristics listed in table 19.3. xtal lrs c l c 0 extal at-cut parallel-resonance type figure 19.3 crystal resonator equivalent circuit table 19.3 crystal resonator parameters frequency (mhz) 2 4 8 10 12 16 18 20 25 rs max ( ? ? ? ? ) 500 120 80 70 60 50 40 40 40 c 0 max (pf) 7 use a crystal resonator with a frequency equal to the system clock frequency ( ). notes on board design when a crystal resonator is connected, the following points should be noted: other signal lines should be routed away from the oscillator circuit to prevent induction from interfering with correct oscillation. see figure 19.4. when the board is designed, the crystal resonator and its load capacitors should be placed as close as possible to the xtal and extal pins.
section 19 clock pulse generator rev. 3.00 sep 27, 2006 page 633 of 872 rej09b0325-0300 xtal extal c l2 c l1 h8/3048b group avoid signal a signal b figure 19.4 example of incorrect board design 19.2.2 external clock input circuit configuration an external clock signal can be input as shown in the examples in figure 19.5. the external clock is input from the extal pin. if the xtal pin is left open, the stray capacitance should not exceed 10 pf. if the stray capacitance at the xtal pin exceeds 10 pf in configuration a, use configuration b instead and hold the clock high in standby mode. extal xtal extal xtal external clock input open 74hc04 external clock input a. xtal pin left open b. complementary clock input at xtal pin figure 19.5 external clock input (examples)
section 19 clock pulse generator rev. 3.00 sep 27, 2006 page 634 of 872 rej09b0325-0300 external clock the external clock frequency should be equal to the system clock frequency ( ) when not divided by the on-chip frequency divider. table 19.4, figures 19.6 and 19.7 indicate the clock timing. when the appropriate external clock is input via the extal pin, its waveform is corrected by the on-chip oscillator and duty adjustment circuit. the resulting stable clock is output to external devices after the external clock settling time (t dext ) has passed after the clock input. the system must remain reset with the reset signal low during t dext , while the clock output is unstable. table 19.4(1) clock timing for h8/3048b group (8 mhz f 25 mhz) v cc = 3.0 v to 3.6 v v cc = 5.0 v 10% item symbol min max min max unit test conditions external clock input low pulse width t exl t cyc /2?5 ? t cyc /2?5 ? ns figure 19.6 external clock input high pulse width t exh t cyc /2?5 ? t cyc /2?5 ? ns external clock rise time t exr ?5 ?5 ns external clock fall time t exf ?5 ?5 ns clock low pulse width t cl 0.4 0.6 0.4 0.6 t cyc figure 21.7 clock high pulse width t ch 0.4 0.6 0.4 0.6 t cyc external clock output settling delay time t dext * 500 ? 500 ? s figure 19.7 note: * t dext includes a res pulse width (t resw ). t resw = 20 t cyc
section 19 clock pulse generator rev. 3.00 sep 27, 2006 page 635 of 872 rej09b0325-0300 table 19.4(2) clock timing for h8/3048b group (2 mhz f < 8 mhz) v cc = 3.0 v to 3.6 v v cc = 5.0 v 10% item symbol min max min max unit test conditions external clock input low pulse width t exl 57 ? 57 ? ns figure 19.6 external clock input high pulse width t exh 57 ? 57 ? ns external clock rise time t exr ?5 ?5 ns external clock fall time t exf ?5 ?5 ns 0.4 0.6 0.4 0.6 t cyc 5 mhz clock low pulse width t cl 80 ? 80 ? ns < 5 mhz 0.4 0.6 0.4 0.6 t cyc 5 mhz clock high pulse width t ch 80 ? 80 ? ns < 5 mhz figure 21.7 external clock output settling delay time t dext * 500 ? 500 ? s figure 19.7 note: * t dext includes a res pulse width (t resw ). t resw = 20 t cyc extal t exr t exf v cc 0.7 0.3 v t exh t exl v cc 0.5 figure 19.6 external clock input timing
section 19 clock pulse generator rev. 3.00 sep 27, 2006 page 636 of 872 rej09b0325-0300 v cc stby extal (internal or external) res t dext v ih figure 19.7 external clock output settling delay timing 19.3 duty adjustment circuit when the oscillator frequency is 5 mhz or higher, the duty adjustment circuit adjusts the duty cycle of the clock signal from the oscillator to generate the signal that becomes the system clock. 19.4 prescalers the prescalers divide the system clock ( ) to generate internal clocks ( /2 to /4096). 19.5 frequency divider the frequency divider divides the duty-adjusted clock signal to generate the system clock ( ). the frequency division ratio can be changed dynamically by modifying the value in divcr, as described below. power consumption in the chip is reduced in almost direct proportion to the frequency division ratio. the system clock generated by the frequency divider can be output at the pin.
section 19 clock pulse generator rev. 3.00 sep 27, 2006 page 637 of 872 rej09b0325-0300 19.5.1 register configuration table 19.5 summarizes the frequency division register. table 19.5 frequency division register address * name abbreviation r/w initial value h'ff5d division control register divcr r/w h'fc note: * the lower 16 bits of the address are shown. 19.5.2 division control register (divcr) divcr is an 8-bit readable/writable register that selects the division ratio of the frequency divider. bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 ? 1 ? 0 div0 0 r/w 2 ? 1 ? 1 div1 0 r/w reserved bits divide bits 1 and 0 these bits select the frequency division ratio divcr is initialized to h'fc by a reset and in hardware standby mode. it is not initialized in software standby mode. bits 7 to 2?reserved: read-only bits, always read as 1. bits 1 and 0?divide (div1 and div0): these bits select the frequency division ratio, as follows. bit 1: div1 bit 0: div0 frequency division ratio 0 0 1/1 (initial value) 11/2 101/4 11/8
section 19 clock pulse generator rev. 3.00 sep 27, 2006 page 638 of 872 rej09b0325-0300 19.5.3 usage notes the divcr setting changes the frequency, so note the following points. ? select a frequency division ratio that stays within the assured operation range specified for the clock cycle time t cyc in the ac electrical characteristics. note that min must be in the lower limit of the clock frequency range. avoid settings that give system clock frequencies less than the lower limit. table 19.6 shows the comparison with the clock frequency range for each version. table 19.6 comparison with the clock frequency ranges in the h8/3048 group and h8/3048b group rom type f-ztat ztat mask rom product type h8/3048 f-one h8/3048f h8/3048 h8/3048 mask rom version h8/3047 mask rom version h8/3045 mask rom version h8/3044 mask rom version h8/3048b mask rom version 4.5?5.5 v 2 ? 25 mhz 1 ? 16 mhz 1 ? 18 mhz 1 ? 18 mhz 2 ? 25 mhz 3.15?5.5 v ? 1 ? 13 mhz 1 ? 13 mhz ? 2.7?5.5 v ? 1 ? 8 mhz 1 ? 8 mhz 1 ? 8 mhz ? guaranteed clock frequency range 3.0?3.6 v 2 ? 25 mhz ?? ? 2 ? 25 mhz crystal oscillation range 2 ? 25 mhz 2 ? 16 mhz 2 ? 18 mhz 2 ? 18 mhz 2 ? 25 mhz ? all on-chip module operations are based on . note that the timing of timer operations, serial communication, and other time-dependent processing differs before and after any change in the division ratio. the waiting time for exit from software standby mode also changes when the division ratio is changed. for details, see section 20.4.3, selection of waiting time for exit from software standby mode.
section 20 power-down state rev. 3.00 sep 27, 2006 page 639 of 872 rej09b0325-0300 section 20 power-down state 20.1 overview the h8/3048b group has a power-down state that greatly reduces power consumption by halting the cpu, and a module standby function that reduces power consumption by selectively halting on-chip modules. the power-down state includes the following three modes: ? sleep mode ? software standby mode ? hardware standby mode the module standby function can halt on-chip supporting modules independently of the power- down state. the modules that can be halted are the itu, sci0, sci1, dmac, refresh controller, and a/d converter. table 20.1 indicates the methods of entering and exiting the power-down modes and module standby mode, and gives the status of the cpu and on-chip supporting modules in each mode.
section 20 power-down state rev. 3.00 sep 27, 2006 page 640 of 872 rej09b0325-0300 table 20.1 power-down state and module standby function mode entering conditions clock cpu cpu registers dmac refresh controller itu sci0 sci1 a/d other modules ram clock output state i/o ports exiting conditions sleep mode sleep instruction executed while ssby = 0 in syscr active halted held active active active active active active active held output held  interrupt  res  stby software standby mode sleep instruction executed while ssby = 1 in syscr halted halted held halted and reset halted and held * 1 halted and reset halted and reset halted and reset halted and reset halted and reset held high output held  nmi  irq 0 to irq 2  res  stby hardware standby mode low input at stby pin halted halted undeter- mined halted and reset halted and reset halted and reset halted and reset halted and reset halted and reset halted and reset held * 3 high impedance high impedance  stby  res module standby corresponding bit set to 1 in mstcr active active ? halted * 2 and reset halted * 2 and held * 1 halted * 2 and reset halted * 2 and reset halted * 2 and reset halted * 2 and reset active ?? high impedance * 2  stby  res  clear mstcr bit to 0 * 4 notes: 1. rtcnt and bits 7 and 6 of rtmcsr are initialized. other bits and registers hold their previous states. 2. state in which the corresponding mstcr bit was set to 1. for details see section 20.2.2, module standby control register (m stcr). 3. the rame bit must be cleared to 0 in syscr before the transition from the program execution state to hardware standby mode. 4. when a mstcr bit is set to 1, the registers of the corresponding on-chip supporting module are initialized. to restart the module, first clear the mstcr bit to 0, then set up the module registers again. legend: syscr: system control register ssby: software standby bit mstcr: module standby control register
section 20 power-down state rev. 3.00 sep 27, 2006 page 641 of 872 rej09b0325-0300 20.2 register configuration the h8/3048b group has a system control register (syscr) that controls the power-down state, and a module standby control register (mstcr) that controls the module standby function. table 20.2 summarizes these registers. table 20.2 control register address * name abbreviation r/w initial value h'fff2 system control register syscr r/w h'0b h'ff5e module standby control register mstcr r/w h'40 note: * lower 16 bits of the address. 20.2.1 system control register (syscr) bit initial value read/write 7 ssby 0 r/w 6 sts2 0 r/w 5 sts1 0 r/w 4 sts0 0 r/w 3 ue 1 r/w 0 rame 1 r/w 2 nmieg 0 r/w 1 ? 1 ? software standby enables transition to software standby mode ram enable standby timer select 2 to 0 these bits select the waiting time at exit from software standby mode user bit enable nmi edge select reserved bit syscr is an 8-bit readable/writable register. bit 7 (ssby) and bits 6 to 4 (sts2 to sts0) control the power-down state. for information on the other syscr bits, see section 3.3, system control register (syscr).
section 20 power-down state rev. 3.00 sep 27, 2006 page 642 of 872 rej09b0325-0300 bit 7?software standby (ssby): enables transition to software standby mode. when software standby mode is exited by an external interrupt, this bit remains set to 1 after the return to normal operation. to clear this bit, write 0. bit 7: ssby description 0 sleep instruction causes transition to sleep mode (initial value) 1 sleep instruction causes transition to software standby mode bits 6 to 4?standby timer select (sts2 to sts0): these bits select the length of time the cpu and on-chip supporting modules wait for the clock to settle when software standby mode is exited by an external interrupt. if the clock is generated by a crystal resonator, set these bits according to the clock frequency so that the waiting time will be at least 7 ms. see table 20.3. if an external clock is used, select the setting so that the waiting time is 100 s or more according to the clock frequency. bit 6: sts2 bit 5: sts1 bit 4: sts0 description 0 0 0 waiting time = 8,192 states (initial value) 1 waiting time = 16,384 states 1 0 waiting time = 32,768 states 1 waiting time = 65,536 states 1 0 0 waiting time = 131,072 states 1 waiting time = 262,144 states 1 0 waiting time = 1,024 states 1 illegal setting
section 20 power-down state rev. 3.00 sep 27, 2006 page 643 of 872 rej09b0325-0300 20.2.2 module standby control register (mstcr) mstcr is an 8-bit readable/writable register that controls output of the system clock ( ). it also controls the module standby function, which places individual on-chip supporting modules in the standby state. module standby can be designated for the itu, sci0, sci1, dmac, refresh controller, and a/d converter modules. bit initial value read/write 7 pstop 0 r/w 6 ? 1 ? 5 mstop5 0 r/w 4 mstop4 0 r/w 3 mstop3 0 r/w 0 mstop0 0 r/w 2 mstop2 0 r/w 1 mstop1 0 r/w clock stop enables or disables output of the system clock module standby 5 to 0 these bits select modules to be placed in standby reserved bit mstcr is initialized to h'40 by a reset and in hardware standby mode. it is not initialized in software standby mode. bit 7? clock stop (pstop): enables or disables output of the system clock ( ). bit 1: pstop description 0 system clock output is enabled (initial value) 1 system clock output is disabled bit 6?reserved: read-only bit, always read as 1. bit 5?module standby 5 (mstop5): selects whether to place the itu in standby. bit 5: mstop5 description 0 itu operates normally (initial value) 1 itu is in standby state
section 20 power-down state rev. 3.00 sep 27, 2006 page 644 of 872 rej09b0325-0300 bit 4?module standby 4 (mstop4): selects whether to place sci0 in standby. bit 4: mstop4 description 0 sci0 operates normally (initial value) 1 sci0 is in standby state bit 3?module standby 3 (mstop3): selects whether to place sci1 in standby. bit 3: mstop3 description 0 sci1 operates normally (initial value) 1 sci1 is in standby state bit 2?module standby 2 (mstop2): selects whether to place the dmac in standby. bit 2: mstop2 description 0 dmac operates normally (initial value) 1 dmac is in standby state bit 1?module standby 1 (mstop1): selects whether to place the refresh controller in standby. bit 1: mstop1 description 0 refresh controller operates normally (initial value) 1 refresh controller is in standby state bit 0?module standby 0 (mstop0): selects whether to place the a/d converter in standby. bit 0: mstop0 description 0 a/d converter operates normally (initial value) 1 a/d converter is in standby state
section 20 power-down state rev. 3.00 sep 27, 2006 page 645 of 872 rej09b0325-0300 20.3 sleep mode 20.3.1 transition to sleep mode when the ssby bit is cleared to 0 in syscr, execution of the sleep instruction causes a transition from the program execution state to sleep mode. immediately after executing the sleep instruction the cpu halts, but the contents of its internal registers are retained. the dma controller (dmac), refresh controller, and on-chip supporting modules do not halt in sleep mode. modules which have been placed in standby by the module standby function, however, remain halted. 20.3.2 exit from sleep mode sleep mode is exited by an interrupt, or by input at the res or stby pin. exit by interrupt: an interrupt terminates sleep mode and causes a transition to the interrupt exception handling state. sleep mode is not exited by an interrupt source in an on-chip supporting module if the interrupt is disabled in the on-chip supporting module. sleep mode is not exited by an interrupt other than nmi if the interrupt is masked by the i and ui bits in ccr and ipr. exit by res res res res input: low input at the res pin exits from sleep mode to the reset state. exit by stby stby stby stby input: low input at the stby pin exits from sleep mode to hardware standby mode. 20.4 software standby mode 20.4.1 transition to software standby mode to enter software standby mode, execute the sleep instruction while the ssby bit is set to 1 in syscr. in software standby mode, current dissipation is reduced to an extremely low level because the cpu, clock, and on-chip supporting modules all halt. the dmac and on-chip supporting modules are reset. as long as the specified voltage is supplied, however, cpu register contents and on-chip ram data are retained. the settings of the i/o ports and refresh controller * are also held. note: * rtcnt and bits 7 and 6 of rtmcsr are initialized. other bits and registers hold their previous states.
section 20 power-down state rev. 3.00 sep 27, 2006 page 646 of 872 rej09b0325-0300 when the wdt is used as a watchdog timer (wt/ it = 1), the tme bit must be cleared to 0 before setting ssby. also, when setting tme to 1, ssby should be cleared to 0. clear the brle bit in brcr (inhibiting bus release) before making a transition to software standby mode. 20.4.2 exit from software standby mode software standby mode can be exited by input of an external interrupt at the nmi, irq 0 , irq 1 , or irq 2 pin, or by input at the res or stby pin. exit by interrupt: when an nmi, irq 0 , irq 1 , or irq 2 interrupt request signal is received, the clock oscillator begins operating. after the oscillator settling time selected by bits sts2 to sts0 in syscr, stable clock signals are supplied to the entire chip, software standby mode ends, and interrupt exception handling begins. software standby mode is not exited if the interrupt enable bits of interrupts irq 0 , irq 1 , and irq 2 are cleared to 0, or if these interrupts are masked in the cpu. exit by res res res res input: when the res input goes low, the clock oscillator starts and clock pulses are supplied immediately to the entire chip. the res signal must be held low long enough for the clock oscillator to stabilize. when res goes high, the cpu starts reset exception handling. exit by stby stby stby stby input: low input at the stby pin causes a transition to hardware standby mode. 20.4.3 selection of waiting time for exit from software standby mode bits sts2 to sts0 in syscr and bits div1 and div0 in divcr should be set as follows. crystal resonator: set sts2 to sts0, div1, and div0 so that the waiting time (for the clock to stabilize) is at least 7 ms. table 20.3 indicates the waiting times that are selected by sts2 to sts0, div1, and div0 settings at various system clock frequencies. refer to the clock frequency and the waiting time in which it takes for the clock to settle, as shown in table 20.3. external clock: set bits sts2 to sts0, bits div0, and div1 so that the waiting time is 100 s or more.
section 20 power-down state rev. 3.00 sep 27, 2006 page 647 of 872 rej09b0325-0300 table 20.3 clock frequency and waiting time for clock to settle div1 div0 sts2 sts1 sts0 waiting time 25 mhz 20 mhz 18 mhz 16 mhz 12 mhz 10 mhz 8 mhz 6 mhz 4 mhz 2 mhz 0 0 0 0 0 8192 states 0.3 0.4 0.46 0.51 0.65 0.8 1.0 1.3 2.0 4.1 0 0 1 16384 states 0.7 0.8 0.91 1.0 1.3 1.6 2.0 2.7 4.1 8.2 * 0 1 0 32768 states 1.3 1.6 1.8 2.0 2.7 3.3 4.1 5.5 8.2 * 16.4 0 1 1 65536 states 2.6 3.3 3.6 4.1 5.5 6.6 8.2 * 10.9 * 16.4 32.8 1 0 0 131072 states 5.2 6.6 7.3 * 8.2 * 10.9 * 13.1 * 16.4 21.8 32.8 65.5 1 0 1 262144 states 10.5 * 13.1 * 14.6 16.4 21.8 26.2 32.8 43.7 65.5 131.1 1 1 0 1024 states 0.04 0.05 0.057 0.064 0.085 0.10 0.13 0.17 0.26 0.51 1 1 1 illegal setting 0 1 0 0 0 8192 states 0.7 0.8 0.91 1.02 1.4 1.6 2.0 2.7 4.1 8.2 * 0 0 1 16384 states 1.3 1.6 1.8 2.0 2.7 3.3 4.1 5.5 8.2 * 16.4 0 1 0 32768 states 2.6 3.3 3.6 4.1 5.5 6.6 8.2 * 10.9 * 16.4 32.8 0 1 1 65536 states 5.2 6.6 7.3 * 8.2 * 10.9 * 13.1 * 16.4 21.8 32.8 65.5 1 0 0 131072 states 10.5 * 13.1 * 14.6 16.4 21.8 26.2 32.8 43.7 65.5 131.1 1 0 1 262144 states 21.0 26.2 29.1 32.8 43.7 52.4 65.5 87.4 131.1 262.1 1 1 0 1024 states 0.08 0.10 0.11 0.13 0.17 0.20 0.26 0.34 0.51 1.0 1 1 1 illegal setting 1 0 0 0 0 8192 states 1.3 1.6 1.8 2.0 2.7 3.3 4.1 5.5 8.2 * 16.4 * 0 0 1 16384 states 2.6 3.3 3.6 4.1 5.5 6.6 8.2 * 10.9 * 16.4 32.8 0 1 0 32768 states 5.2 6.6 7.3 * 8.2 * 10.9 * 13.1 * 16.4 21.8 32.8 65.5 0 1 1 65536 states 10.5 * 13.1 * 14.6 16.4 21.8 26.2 32.8 43.7 65.5 131.1 1 0 0 131072 states 21.0 26.2 29.1 32.8 43.7 52.4 65.5 87.4 131.1 262.1 1 0 1 262144 states 41.9 52.4 58.3 65.5 87.4 104.9 131.1 174.8 262.1 524.3 1 1 0 1024 states 0.16 0.20 0.23 0.26 0.34 0.41 0.51 0.68 1.02 2.0 1 1 1 illegal setting 1 1 0 0 0 8192 states 2.6 3.3 3.6 4.1 5.5 6.6 8.2 * 10.9 * 16.4 * 32.8 * 0 0 1 16384 states 5.2 6.6 7.3 * 8.2 * 10.9 * 13.1 * 16.4 21.8 32.8 65.5 0 1 0 32768 states 10.5 13.1 * 14.6 16.4 21.8 26.2 32.8 43.7 65.5 131.1 0 1 1 65536 states 21.0 * 26.2 29.1 32.8 43.7 52.4 65.5 87.4 131.1 262.1 1 0 0 131072 states 41.9 52.4 58.3 65.5 87.4 104.9 131.1 174.8 262.1 524.3 1 0 1 262144 states 83.9 104.9 116.5 131.1 174.8 209.7 262.1 349.5 524.3 1048.6 1 1 0 1024 states 0.33 0.41 0.46 0.51 0.68 0.82 1.0 1.4 2.0 4.1 1 1 1 illegal setting note: * recommended setting unit ms ms ms ms
section 20 power-down state rev. 3.00 sep 27, 2006 page 648 of 872 rej09b0325-0300 20.4.4 sample application of software standby mode figure 20.1 shows an example in which software standby mode is entered at the fall of nmi and exited at the rise of nmi. with the nmi edge select bit (nmieg) cleared to 0 in syscr (selecting the falling edge), an nmi interrupt occurs. next the nmieg bit is set to 1 (selecting the rising edge) and the ssby bit is set to 1; then the sleep instruction is executed to enter software standby mode. software standby mode is exited at the next rising edge of the nmi signal. nmi nmieg ssby nmi interrupt handler nmieg = 1 ssby = 1 software standby mode (power- down state) oscillator settling time (t osc2 ) sleep instruction nmi exception handling clock oscillator figure 20.1 nmi timing for software standby mode (example) 20.4.5 note the i/o ports retain their existing states in software standby mode. if a port is in the high output state, its output current is not reduced.
section 20 power-down state rev. 3.00 sep 27, 2006 page 649 of 872 rej09b0325-0300 20.5 hardware standby mode 20.5.1 transition to hardware standby mode regardless of its current state, the chip enters hardware standby mode whenever the stby pin goes low. hardware standby mode reduces power consumption drastically by halting all functions of the cpu, dmac, refresh controller, and on-chip supporting modules. all modules are reset except the on-chip ram. as long as the specified voltage is supplied, on-chip ram data is retained. i/o ports are placed in the high-impedance state. clear the rame bit to 0 in syscr before stby goes low to retain on-chip ram data. the inputs at the mode pins (md 2 to md 0 ) should not be changed during hardware standby mode. 20.5.2 exit from hardware standby mode hardware standby mode is exited by inputs at the stby and res pins. while res is low, when stby goes high, the clock oscillator starts running. res should be held low long enough for the clock oscillator to settle. when res goes high, reset exception handling begins, followed by a transition to the program execution state. 20.5.3 timing for hardware standby mode figure 20.2 shows the timing relationships for hardware standby mode. to enter hardware standby mode, first drive res low, then drive stby low. to exit hardware standby mode, first drive stby high, wait for the clock to settle, then bring res from low to high.
section 20 power-down state rev. 3.00 sep 27, 2006 page 650 of 872 rej09b0325-0300 res stby clock oscillator oscillator settling time reset exception handling figure 20.2 hardware standby mode timing 20.6 module standby function 20.6.1 module standby timing the module standby function can halt several of the on-chip supporting modules (the itu, sci0, sci1, dmac, refresh controller, and a/d converter) independently of the power-down state. this standby function is controlled by bits mstop5 to mstop0 in mstcr. when one of these bits is set to 1, the corresponding on-chip supporting module is placed in standby and halts at the beginning of the next bus cycle after the mstcr write cycle. 20.6.2 read/write in module standby when an on-chip supporting module is in module standby, read/write access to its registers is disabled. read access always results in h'ff data. write access is ignored.
section 20 power-down state rev. 3.00 sep 27, 2006 page 651 of 872 rej09b0325-0300 20.6.3 usage notes when using the module standby function, note the following points. dmac and refresh controller: when setting bit mstop2 or mstop1 to 1 to place the dmac or refresh controller in module standby, make sure that the dmac or refresh controller is not currently requesting the bus right. if bit mstop2 or mstop1 is set to 1 when a bus request is present, operation of the bus arbiter becomes ambiguous and a malfunction may occur. internal peripheral module interrupt: when mstcr is set to 1, prevent module interrupt in advance. when an on-chip supporting module is placed in standby by the module standby function, its registers, including the interrupt flag, are initialized. pin states: pins used by an on-chip supporting module lose their module functions when the module is placed in module standby. what happens after that depends on the particular pin. for details, see section 9, i/o ports. pins that change from the input to the output state require special care. for example, if sci1 is placed in module standby, the receive data pin loses its receive data function and becomes a generic i/o pin. if its data direction bit is set to 1, the pin becomes a data output pin, and its output may collide with external serial data. data collisions should be prevented by clearing the data direction bit to 0 or taking other appropriate action. register resetting: when an on-chip supporting module is halted by the module standby function, all its registers are initialized. to restart the module, after its mstcr bit is cleared to 0, its registers must be set up again. it is not possible to write to the registers while the mstcr bit is set to 1. mstcr access from dmac disabled: to prevent malfunctions, mstcr can only be accessed from the cpu. it can be read by the dmac, but it cannot be written by the dmac.
section 20 power-down state rev. 3.00 sep 27, 2006 page 652 of 872 rej09b0325-0300 20.7 system clock output disabling function output of the system clock ( ) can be controlled by the pstop bit in mstcr. when the pstop bit is set to 1, output of the system clock halts and the pin is placed in the high-impedance state. figure 20.3 shows the timing of the stopping and starting of system clock output. when the pstop bit is cleared to 0, output of the system clock is enabled. table 20.4 indicates the state of the pin in various operating states. t1 t2 (pstop = 1) t3 t1 t2 (pstop = 0) mstcr write cycle mstcr write cycle high-impedance pin t3 figure 20.3 starting and stopping of system clock output table 20.4 pin state in various operating states operating state pstop = 0 pstop = 1 hardware standby high-impedance high-impedance software standby always high high-impedance sleep mode system clock output high-impedance normal operation system clock output high-impedance
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 653 of 872 rej09b0325-0300 section 21 electrical characteristics table 21.1 shows the electrical characteristics of the various products in the h8/3048 group and h8/3048b group. table 21.1 electrical characteristics of h8/3048 group and h8/3048b group products h8/3048 group h8/3048b group item symbol unit h8/3048 f-ztat (dual power supply) h8/3048 h8/3047 h8/3045 h8/3044 h8/3048 ztat h8/3048 f-one (single power supply) h8/3048b mask rom v cc = 4.5 to 5.5 v mhz 1 to 16 1 to 18 1 to 18 2 to 25 (5 v operation model) 2 to 25 (5 v operation model) v cc = 3.15 to 5.5 v ? 1 to 13 1 to 13 ? ? v cc = 2.7 to 5.5 v 1 to 8 1 to 8 1 to 8 ? ? operating range v cc = 3.0 to 3.6 v ? ? ? 2 to 25 (3 v operation model) 2 to 25 (3 v operation model) regular specifications t opr c ?20 to +75 ?20 to +75 ?20 to +75 ?20 to +75 * 1 ?20 to +75 * 1 operating temperature range wide-range specifications ?40 to +85 ?40 to +85 ?40 to +85 ?40 to +85 * 1 ?40 to +85 * 1 v pp pin rating v in yes ? yes ? ? fwe pin rating ? ? ? yes ? absolute maximum ratings v cl pin ? ? ? cannot be connected to power supply * 2 (5 v operation model only) cannot be connected to power supply * 2 (5 v operation model only)
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 654 of 872 rej09b0325-0300 h8/3048 group h8/3048b group item symbol unit h8/3048 f-ztat (dual power supply) h8/3048 h8/3047 h8/3045 h8/3044 h8/3048 ztat h8/3048 f-one (single power supply) h8/3048b mask rom absolute maximum ratings power supply voltage v in v ?0.3 to +7.0 ?0.3 to +7.0 ?0.3 to +7.0 ?0.3 to +7.0 (5 v operation model) ?0.3 to +4.6 (3 v operation model) ?0.3 to +7.0 (5 v operation model) ?0.3 to +4.6 (3 v operation model) dc charac- teristics reso pin specification yes yes yes ? yes fwe pin specification ???yes? determination level for applying high voltage (12 v) yes ? ? ? ? standby current (t a 50c) i cc * 3 a max 5 max 5 max 5 max 10 max 10 standby current (50c < t a ) max 20 max 20 max 20 max 80 max 80 clock cycle time t cyc ns max 1000 max 1000 max 1000 max 500 max 500 res pulse width t resw t cyc min 10 min 10 min 10 min 20 min 20 reso output delay time t resd ns max 100 max 100 max 100 ? ? ac charac- teristics reso output pulse width t resow t cyc min 132 min 132 min 132 ? ? flash memory charac- teristics * 4 refer to the h8/3048 group hardware manual (revision 7.0) for details. ? ? see table 21.11 ? notes: 1. the operating temperature range for flash memory programming/erasing is 0c to +75. 2. connect an external capacitor between the v cl pin and gnd. 3. see the dc characteristics table for current dissipation during operation. 4. refer to the program/erase algorithms for details of flash memory characteristics.
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 655 of 872 rej09b0325-0300 21.1 electrical characteristics of h8/3048f-one (single-power supply) 21.1.1 absolute maximum ratings table 21.2 lists the absolute maximum ratings. table 21.2 absolute maximum ratings item symbol value unit 5 v operation model: ?0.3 to +7.0 power supply voltage v cc * 1 3 v operation model: ?0.3 to +4.6 v input voltage (fwe) * 2 v in ?0.3 to v cc +0.3 v input voltage (except for port 7) * 2 v in ?0.3 to v cc +0.3 v input voltage (port 7) v in ?0.3 to av cc +0.3 v reference voltage v ref ?0.3 to av cc +0.3 v 5 v operation model: ?0.3 to +7.0 analog power supply voltage av cc 3 v operation model: ?0.3 to +4.6 v analog input voltage v an ?0.3 to av cc +0.3 v regular specifications: ?20 to +75 * 3 operating temperature t opr wide-range specifications: ?40 to +85 * 3 c storage temperature t stg ?55 to +125 c caution: permanent damage to the chip may result if absolute maximum ratings are exceeded. notes: 1. do not apply the power supply voltage to the v cl pin in 5 v operation models. connect an external capacitor between this pin and gnd. 2. 12 v must not be applied to any pin, as this may cause permanent damage to the device. 3. the operating temperature range for flash memory programming/erasing is 0c to +75c.
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 656 of 872 rej09b0325-0300 21.1.2 dc characteristics table 21.3 lists the dc characteristics. table 21.4 lists the permissible output currents. table 21.3 dc characteristics (1) conditions: v cc = 5.0 v 10%, av cc = 5.0 v 10%, v ref = 4.5 v to av cc , v ss = av ss = 0 v * 1 , t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications), (t a = 0c to +75c during program/erase) item symbol min typ max unit test conditions v t ? 1.0 ? ? v v t + ??v cc 0.7 v schmitt trigger input voltages port a, p8 2 to p8 0 , pb 3 to pb 0 v t + ? v t ? 0.4 ? ? v res , stby , fwe, nmi, md 2 to md 0 v cc ?0.7 ? v cc +0.3 v extal v cc 0.7 ? v cc +0.3 v port 7 2.0 ? av cc +0.3 v input high voltage ports 1 to 6, 9, p8 4 , p8 3 , pb 7 to pb 4 v ih 2.0 ? v cc +0.3 v res , stby , md 2 to md 0 , fwe ?0.3 ? 0.5 v input low voltage nmi, extal, ports 1 to 7, 9, p8 4 , p8 3 , pb 7 to pb 4 v il ?0.3 ? 0.8 v v cc ?0.5 ? ? v i oh = ?200 a output high voltage all output pins v oh 3.5 ? ? v i oh = ?1 ma all output pins ? ? 0.4 v i ol = 1.6 ma output low voltage ports 1, 2, 5, and b v ol ??1.0v i ol = 10 ma stby , nmi, res , fwe, md 2 to md 0 ??1.0av in = 0.5 to v cc ?0.5 v input leakage current port 7 |i in | ??1.0av in = 0.5 to av cc ?0.5 v
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 657 of 872 rej09b0325-0300 item symbol min typ max unit test conditions three-state leakage current (off state) ports 1 to 6, 8 to b |i tsi |? ?1.0 av in = 0.5 to v cc ?0.5 v input pull-up mos current ports 2, 4, and 5 ?i p 50 ? 300 a v in = 0 v fwe ? ? 60 pf nmi ? ? 50 pf input capacitance all input pins except nmi, fwe c in ? ? 15 pf v in = 0 v, f = fmin, t a = 25c normal operation * 5 ?4560ma sleep mode ? 35 50 ma module standby mode * 4 ?2025ma f = 25 mhz ? 1 10 a t a 50c current dissipation * 2 standby mode * 3 i cc * 6 ? ? 80 a 50c < t a during a/d conversion ?0.51.5maav cc = 5.0 v during a/d and d/a conversion ?0.51.5ma analog power supply current idle ai cc ? 0.01 5.0 a daste = 0 during a/d conversion ?0.40.8mav ref = 5.0 v during a/d and d/a conversion ?1.53.0ma reference current idle ai cc ? 0.01 5.0 a daste = 0 ram standby voltage v ram 2.0 ? ? v notes: 1. if the a/d and d/a converters are not used, do not leave the av cc , av ss , and v ref pins open. connect av cc and v ref to v cc , and connect av ss to v ss . 2. current dissipation values are for v ih min = v cc ?0.5 v and v il max = 0.5 v with all output pins unloaded and the on-chip pull-up transistors in the off state. 3. the values are for v ram v cc < 4.5 v, v ih min = v cc 0.9, and v il max = 0.3 v. 4. module standby current values apply in sleep mode with all modules halted. 5. the current dissipation value for flash memory program/erase operations (t a = 0c to +75c) is 10 ma (max.) greater than the current dissipation value for normal operation.
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 658 of 872 rej09b0325-0300 6. i cc depends on v cc and f, according to the following expressions. i cc max. (normal operation) = 10.0 [ma] + 0.36 [ma/(mhz v)] v cc f i cc max. (sleep mode) = 10.0 [ma] + 0.29 [ma/(mhz v)] v cc f i cc max. (sleep mode and module standby mode) = 10.0 [ma] + 0.11 [ma/(mhz v)] v cc f the typical values of current dissipation are reference values.
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 659 of 872 rej09b0325-0300 table 21.3 dc characteristics (2) conditions: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v * 1 , t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications), (t a = 0c to +75c during program/erase) item symbol min typ max unit test conditions v t ? v cc 0.2 ? ? v v t + ??v cc 0.7 v schmitt trigger input voltages port a, p8 2 to p8 0 , pb 3 to pb 0 v t + ? v t ? v cc 0.05 ? ? v res , stby , fwe, nmi, md 2 to md 0 v cc 0.9 ? v cc +0.3 v extal v cc 0.7 ? v cc +0.3 v port 7 v cc 0.7 ? av cc +0.3 v input high voltage ports 1 to 6, 9, p8 4 , p8 3 , pb 7 to pb 4 v ih v cc 0.7 ? v cc +0.3 v res , stby , md 2 to md 0 , fwe ?0.3 ? v cc 0.1 v input low voltage nmi, extal, ports 1 to 7, 9, p8 4 , p8 3 , pb 7 to pb 4 v il ?0.3 ? v cc 0.2 v v cc ?0.5 ? ? v i oh = ?200 a output high voltage all output pins v oh v cc ?1.0 ? ? v i oh = ?1 ma all output pins ? ? 0.4 v i ol = 1.6 ma output low voltage ports 1, 2, 5, and b v ol ??1.0vi ol = 5 ma stby , nmi, res , fwe, md 2 to md 0 ??1.0av in = 0.5 to v cc ?0.5 v input leakage current port 7 |i in | ??1.0av in = 0.5 to av cc ?0.5 v three-state leakage current (off state) ports 1 to 6, 8 to b |i tsi |? ?1.0 av in = 0.5 to v cc ?0.5 v
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 660 of 872 rej09b0325-0300 item symbol min typ max unit test conditions input pull-up mos current ports 2, 4, and 5 ?i p 10 ? 300 a v in = 0 v fwe ? ? 60 pf nmi ? ? 50 pf input capacitance all input pins except nmi, fwe c in ? ? 15 pf v in = 0 v, f = fmin, t a = 25c normal operation * 5 ?4060ma sleep mode ? 30 50 ma module standby mode * 4 ?2025ma f = 25 mhz ? 1 10 a t a 50c current dissipation * 2 standby mode * 3 i cc * 6 ? ? 80 a 50c < t a during a/d conversion ?0.51.5maav cc = 3.3 v analog power supply current during a/d and d/a conversion ?0.51.5ma idle ai cc ? 0.01 5 a daste = 0 during a/d conversion ?0.40.8mav ref = 3.3 v during a/d and d/a conversion ?1.53 ma reference current idle ai cc ? 0.01 5 a daste = 0 ram standby voltage v ram 2.0 ? ? v notes: 1. if the a/d and d/a converters are not used, do not leave the av cc , av ss , and v ref pins open. connect av cc and v ref to v cc , and connect av ss to v ss . 2. current dissipation values are for v ih min = v cc ?0.5 v and v il max = 0.5 v with all output pins unloaded and the on-chip pull-up transistors in the off state. 3. the values are for v ram v cc < 3.0 v, v ih min = v cc 0.9, and v il max = 0.3 v. 4. module standby current values apply in sleep mode with all modules halted. 5. the current dissipation value for flash memory program/erase operations (t a = 0c to +75c) is 10 ma (max.) greater than the current dissipation value for normal operation. 6. i cc depends on v cc and f, according to the following expressions. i cc max. (normal operation) = 6.0 [ma] + 0.60 [ma/(mhz v)] v cc f i cc max. (sleep mode) = 6.0 [ma] + 0.49 [ma/(mhz v)] v cc f i cc max. (sleep mode and module standby mode) = 6.0 [ma] + 0.21 [ma/(mhz v)] v cc f the typical values of current dissipation are reference values.
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 661 of 872 rej09b0325-0300 table 21.4 permissible output currents condition a: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) condition b: v cc = 5.0 v 10%, av cc = 5.0 v 10%, v ref = 4.5 v to av cc , v ss = av ss = 0 v, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) conditions a, b item symbol min typ max unit ports 1, 2, 5, and b ? ? 10 ma permissible output low current (per pin) other output pins i ol ??2.0ma total of 28 pins in ports 1, 2, 5, and b ??80ma permissible output low current (total) total of all output pins, including the above i ol ? ? 120 ma permissible output high current (per pin) all output pins i oh ??2.0ma permissible output high current (total) total of all output pins i oh ??40ma notes: 1. to protect chip reliability, do not exceed the output current values in table 21.4. 2. when driving a darlington pair or led, always insert a current-limiting resistor in the output line, as shown in figures 21.1 and 21.2.
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 662 of 872 rej09b0325-0300 h8/3048f-one port 2 k ? figure 21.1 darlington pair drive circuit (example) h8/3048f-one ports 1, 2, 5, and b led 600 ? figure 21.2 led drive circuit (example)
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 663 of 872 rej09b0325-0300 21.1.3 ac characteristics bus timing parameters are listed in table 21.5. refresh controller bus timing parameters are listed in table 21.6. control signal timing parameters are listed in table 21.7. timing parameters of the on-chip supporting modules are listed in table 21.8. table 21.5 bus timing condition a: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) condition b: v cc = 5.0 v 10%, av cc = 5.0 v 10%, v ref = 4.5 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) condition a condition b 25 mhz 25 mhz item symbol min max min max unit test conditions clock cycle time t cyc 40 500 40 500 ns clock pulse low width t cl 10 ? 10 ? clock pulse high width t ch 10 ? 10 ? figure 21.7 figure 21.8 clock rise time t cr ? 10 ? 10 clock fall time t cf ? 10 ? 10 address delay time t ad ? 28 ? 25 address hold time t ah 0.5t cyc ? 20 ? 0.5t cyc ? 20 ? address strobe delay time t asd ? 25 ? 25 write strobe delay time t wsd ? 25 ? 25 strobe delay time t sd ? 25 ? 25 write data strobe pulse width 1 t wsw1 1.0t cyc ? 25 ? 1.0t cyc ? 25 ? write data strobe pulse width 2 t wsw2 1.5t cyc ? 25 ? 1.5t cyc ? 25 ? address setup time 1 t as1 0.5t cyc ? 20 ? 0.5t cyc ? 20 ? address setup time 2 t as2 1.0t cyc ? 20 ? 1.0t cyc ? 20 ? read data setup time t rds 15 ? 15 ? read data hold time t rdh 0 ? 0 ?
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 664 of 872 rej09b0325-0300 condition a condition b 25 mhz 25 mhz item symbol min max min max unit test conditions write data delay time t wdd ? 35 ? 35 ns write data setup time 1 t wds1 1.0t cyc ? 30 ? 1.0t cyc ? 30 ? figure 21.7 figure 21.8 write data setup time 2 t wds2 0.5t cyc ? 30 ? 0.5t cyc ? 30 ? write data hold time t wdh 0.5t cyc ? 15 ? 0.5t cyc ? 15 ? read data access time 1 t acc1 ? 1.5t cyc ? 40 ? 1.5t cyc ? 40 read data access time 2 t acc2 ? 2.5t cyc ? 40 ? 2.5t cyc ? 40 read data access time 3 t acc3 ? 1.0t cyc ? 28 ? 1.0t cyc ? 28 read data access time 4 t acc4 ? 2.0t cyc ? 32 ? 2.0t cyc ? 32 precharge time t pch 1.0t cyc ? 20 ? 1.0t cyc ? 20 ? wait setup time t wts 25 ? 25 ? ns figure 21.9 wait hold time t wth 5 ? 5 ? bus request setup time t brqs 25 ? 25 ? ns figure 21.21 bus acknowledge delay time 1 t bacd1 ? 30 ? 30 bus acknowledge delay time 2 t bacd2 ? 30 ? 30 bus-floating time t bzd ? 40 ? 40
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 665 of 872 rej09b0325-0300 table 21.6 refresh controller bus timing condition a: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) condition b: v cc = 5.0 v 10%, av cc = 5.0 v 10%, v ref = 4.5 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) condition a condition b 25 mhz 25 mhz item symbol min max min max unit test conditions ras delay time 1 * 1 t rad1 ? 20 ? 18 ns ras delay time 2 * 1 t rad2 ? 20 ? 18 ras delay time 3 * 1 t rad3 ? 20 ? 18 row address hold time t rah 0.5t cyc ? 5 ? 0.5t cyc ? 5 ? ras precharge time * 1 t rp 1.0t cyc ? 15 ? 1.0t cyc ? 15 ? cas to ras precharge time * 1 * 2 t crp 1.0t cyc ? 15 ? 1.0t cyc ? 15 ? cas pulse width * 2 t cas 1.0t cyc ? 18 ? 1.0t cyc ? 18 ? ras access time * 1 t rac ? 2.0t cyc ? 35 ? 2.0t cyc ? 35 address access time t aa ? 1.5t cyc ? 40 ? 1.5t cyc ? 40 cas access time * 2 t cac ? 1.0t cyc ? 30 ? 1.0t cyc ? 30 write data setup time 3 t wds3 1.0t cyc ? 25 ? 1.0t cyc ? 25 ? cas setup time * 2 t csr 0.5t cyc ? 15 ? 0.5t cyc ? 15 ? read strobe delay time t rsd ? 25 ? 25 figure 21.10 to figure 21.16 signal rise time (all input pins except extal) t sr ? 100 ? 100 ns figure 21.18 signal fall time (all input pins except extal) t sf ? 100 ? 100 notes: 1. the ras pin is assigned to the cs3 pin. 2. the cas pin is assigned to the rd pin.
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 666 of 872 rej09b0325-0300 table 21.7 control signal timing condition a: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) condition b: v cc = 5.0 v 10%, av cc = 5.0 v 10%, v ref = 4.5 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) condition a condition b 25 mhz 25 mhz item symbol min max min max unit test conditions res setup time t ress 200 ? 200 ? ns figure 21.18 res pulse width t resw 20 ? 20 ? t cyc mode programming setup time t mds 200 ? 200 ? ns nmi setup time (nmi, irq 5 to irq 0 ) t nmis 150 ? 150 ? ns figure 21.20 nmi hold time (nmi, irq 5 to irq 0 ) t nmih 10 ? 10 ? interrupt pulse width (nmi, irq 2 to irq 0 when exiting software standby mode) t nmiw 200 ? 200 ? clock oscillator settling time at reset (crystal) t osc1 20 ? 20 ? ms figure 21.22 clock oscillator settling time in software standby (crystal) t osc2 7 ? 7 ? ms figure 20.1
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 667 of 872 rej09b0325-0300 table 21.8 timing of on-chip supporting modules condition a: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) condition b: v cc = 5.0 v 10%, av cc = 5.0 v 10%, v ref = 4.5 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) condition a condition b 25 mhz 25 mhz item symbol min max min max unit test conditions dmac dreq setup time t drqs 20 ? 20 ? ns figure 21.30 dreq hold time t drqh 10 ? 10 ? tend delay time 1 t ted1 ? 50 ? 50 tend delay time 2 t ted2 ? 50 ? 50 figures 21.28 and 21.29 itu timer output delay time t tocd ? 50 ? 50 ns figure 21.24 timer input setup time t tics 40 ? 40 ? timer clock input setup time t tcks 40 ? 40 ? figure 21.25 single edge t tckwh 1.5 ? 1.5 ? t cyc timer clock pulse width both edges t tckwl 2.5 ? 2.5 ? sci asynchronous t scyc 4 ? 4 ? t cyc figure 21.26 input clock cycle synchronous t scyc 6 ? 6 ? input clock rise time t sckr ? 1.5 ? 1.5 input clock fall time t sckf ? 1.5 ? 1.5 input clock pulse width t sckw 0.4 0.6 0.4 0.6 t scyc transmit data delay time t txd ? 100 ? 100 ns figure 21.27 receive data setup time (synchronous) t rxs 100 ? 100 ? clock input t rxh 100 ? 100 ? receive data hold time (syn- chronous) clock output t rxh 0 ? 0 ? output data delay time t pwd ? 50 ? 50 ns figure 21.23 input data setup time t prs 50 ? 50 ? ports and tpc input data hold time t prh 50 ? 50 ?
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 668 of 872 rej09b0325-0300 cr h r l h8/3048f-one output pin c = 90 pf: ports 4, 5, 6, 8, a (19 to 0), d (15 to 8),  low: 0.8 v  high: 2.0 v r = 2.4 k r = 12 k l h ? ? figure 21.3 output load circuit
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 669 of 872 rej09b0325-0300 21.1.4 a/d conversion characteristics table 21.9 lists the a/d conversion characteristics. table 21.9 a/d converter characteristics condition a: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) condition b: v cc = 5.0 v 10%, av cc = 5.0 v 10%, v ref = 4.5 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) condition a condition b 25 mhz 25 mhz item min typ max min typ max unit resolution 10 10 10 10 10 10 bits conversion time (single mode) 5.36 ?? 5.36 ?? s analog input capacitance ?? 20 ?? 20 pf ?? 10 ?? 10 permissible signal-source impedance > ?? 5 ?? 5 k ? ?? 3.5 ?? 3.5 lsb offset error ?? 3.5 ?? 3.5 lsb full-scale error ?? 3.5 ?? 3.5 lsb quantization error ?? 0.5 ?? 0.5 lsb absolute accuracy ?? 4.0 ?? 4.0 lsb
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 670 of 872 rej09b0325-0300 21.1.5 d/a conversion characteristics table 21.10 lists the d/a conversion characteristics. table 21.10 d/a converter characteristics condition a: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) condition b: v cc = 5.0 v 10%, av cc = 5.0 v 10%, v ref = 4.5 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) condition a condition b 25 mhz 25 mhz item min typ max min typ max unit test conditions resolution 888 888bits conversion time (centering time) ?? 10 ?? 10 s 20-pf capacitive load ? 2.0 3.0 ? 1.5 2.0 lsb 2-m ? ?? 2.0 ?? 1.5 lsb 4-m ?
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 671 of 872 rej09b0325-0300 21.1.6 flash memory characteristics table 21.11 lists the flash memory characteristics. table 21.11 flash memory characteristics (1) conditions: v cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, v ref = 4.5 v to av cc , v ss = av ss = 0 v, t a = 0c to +75c (program/erase operating temperature range) item symbol min typ max unit notes programming time * 1 * 2 * 4 t p ? 10 200 ms/ 128 bytes erase time * 1 * 3 * 5 t e ? 100 1200 ms/block reprogramming count n wec ?? 100 times programming wait time after swe bit setting * 1 t sswe 11 ? s wait time after psu bit setting * 1 t spsu 50 50 ? s wait time after p bit setting * 1 * 4 t sp30 28 30 32 s programming time wait t sp200 198 200 202 s programming time wait t sp10 81012s additional programming time wait wait time after p bit clear * 1 t cp 55 ? s wait time after psu bit clear * 1 t cpsu 55 ? s wait time after pv bit setting * 1 t spv 44 ? s wait time after h'ff dummy write * 1 t spvr 22 ? s wait time after pv bit clear * 1 t cpv 22 ? s wait time after swe bit clear * 1 t cswe 100 100 ? * 1 * 4 n ?? 1000 times erase wait time after swe bit setting * 1 t sswe 11 ? s wait time after esu bit setting * 1 t sesu 100 100 ? s wait time after e bit setting * 1 * 5 t se 10 10 100 ms erase time wait wait time after e bit clear * 1 t ce 10 10 ? s wait time after esu bit clear * 1 t cesu 10 10 ? s wait time after ev bit setting * 1 t sev 20 20 ? s wait time after h'ff dummy write * 1 t sevr 22 ? s wait time after ev bit clear * 1 t cev 44 ? s wait time after swe bit clear * 1 t cswe 100 100 ? * 1 * 5 n12 ? 120 times
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 672 of 872 rej09b0325-0300 notes: 1. set the times according to the program/erase algorithms. 2. programming time per 128 bytes. (shows the total time the p bit in the flash memory control register (flmcr1) is set. it does not include the programming verification time.) 3. block erase time. (shows the total time the e bit in flmcr1 is set. it does not include the erase verification time.) 4. to specify the maximum programming time value (t p (max)) in the 128-byte programming algorithm, set the max. value (1000) for the maximum programming count (n). the wait time after p bit setting should be changed as follows according to the value of the programming counter (n). programming counter (n) = 1 to 6: t sp30 = 30 s programming counter (n) = 7 to 1000: t sp200 = 200 s programming counter (n) [in additional programming] = 1 to 6: t sp10 = 10 s 5. for the maximum erase time (t e (max)), the following relationship applies between the wait time after e bit setting (t se ) and the maximum erase count (n): t e (max) = wait time after e bit setting (t se ) x maximum erase count (n) to set the maximum erase time, the values of t se and n should be set so as to satisfy the above formula. examples: when t se = 100 [ms], n = 12 when t se = 10 [ms], n = 120
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 673 of 872 rej09b0325-0300 table 21.11 flash memory characteristics (2) conditions: v cc = 3.0 to 3.6 v, av cc = 3.0 to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, t a = 0c to +75c (operating temperature range for programming/erasing) item symbol min typ max unit notes programming time * 1 * 2 * 4 t p ? 10 200 ms/ 128 bytes erase time * 1 * 3 * 5 t e ? 100 1200 ms/block reprogramming count n wec ?? 100 times programming wait time after swe bit setting * 1 t sswe 11 ? s wait time after psu bit setting * 1 t spsu 50 50 ? s wait time after p bit setting * 1 * 4 t sp30 28 30 32 s programming time wait t sp200 198 200 202 s programming time wait t sp10 81012s additional- programming time wait wait time after p bit clear * 1 t cp 55 ? s wait time after psu bit clear * 1 t cpsu 55 ? s wait time after pv bit setting * 1 t spv 44 ? s wait time after h'ff dummy write * 1 t spvr 22 ? s wait time after pv bit clear * 1 t cpv 22 ? s wait time after swe bit clear * 1 t cswe 100 100 ? s maximum programming count * 1 * 4 n ?? 1000 times erase wait time after swe bit setting * 1 t sswe 11 ? s wait time after esu bit setting * 1 t sesu 100 100 ? s wait time after e bit setting * 1 * 5 t se 10 10 100 ms erase time wait wait time after e bit clear * 1 t ce 10 10 ? s wait time after esu bit clear * 1 t cesu 10 10 ? s wait time after ev bit setting * 1 t sev 20 20 ? s wait time after h'ff dummy write * 1 t sevr 22 ? s wait time after ev bit clear * 1 t cev 44 ? s wait time after swe bit clear * 1 t cswe 100 100 ? s maximum erase count * 1 * 5 n12 ? 120 times
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 674 of 872 rej09b0325-0300 notes: 1. make each time setting in accordance with the program/program-verify flowchart or erase/erase-verify flowchart. 2. programming time per 128 bytes (shows the total period for which the p bit in the flash memory control register 1 (flmcr1) is set. it does not include the programming verification time.) 3. block erase time (shows the total period for which the e bit in flmcr1 is set. it does not include the erase verification time.) 4. to specify the maximum programming time (t p (max)) in the 128-byte programming flowchart, set the maximum value (1000) for the maximum programming count (n). the wait time after p bit setting should be changed as follows according to the value of the programming counter (n). programming counter (n) = 1 to 6: t sp30 = 30 s programming counter (n) = 7 to 1000: t sp200 = 200 s programming counter (n) [in additional programming] = 1 to 6: t sp10 = 10 s 5. for the maximum erase time (t e (max)), the following relationship applies between the wait time after e bit setting (t se ) and the maximum erase count (n): t e (max) = wait time after e bit setting (t se )
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 675 of 872 rej09b0325-0300 21.2 electrical characteristics of h8/3048b (mask rom) 21.2.1 absolute maximum ratings table 21.12 lists the absolute maximum ratings. table 21.12 absolute maximum ratings item symbol value unit 5 v operation model: ? 0.3 to +7.0 power supply voltage v cc * 1 3 v operation model: ? 0.3 to +4.6 v input voltage (fwe) * 2 v in ? 0.3 to v cc +0.3 v input voltage (except for port 7) * 2 v in ? 0.3 to v cc +0.3 v input voltage (port 7) v in ? 0.3 to av cc +0.3 v reference voltage v ref ? 0.3 to av cc +0.3 v 5 v operation model: ? 0.3 to +7.0 analog power supply voltage av cc 3 v operation model: ? 0.3 to +4.6 v analog input voltage v an ? 0.3 to av cc +0.3 v regular specifications: ? 20 to +75 * 3 operating temperature t opr wide-range specifications: ? 40 to +85 * 3 c storage temperature t stg ? 55 to +125 c caution: permanent damage to the chip may result if absolute maximum ratings are exceeded. notes: 1. do not apply the power supply voltage to the v cl pin in 5 v operation models. connect an external capacitor between this pin and gnd. 2. 12 v must not be applied to any pin, as this may cause permanent damage to the device. 3. the operating temperature range for flash memory programming/erasing is 0 c to +75 c.
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 676 of 872 rej09b0325-0300 21.2.2 dc characteristics table 21.13 lists the dc characteristics. table 21.14 lists the permissible output currents. table 21.13 dc characteristics (1) conditions: v cc = 5.0 v 10%, av cc = 5.0 v 10%, v ref = 4.5 v to av cc , v ss = av ss = 0 v * 1 , t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) item symbol min typ max unit test conditions v t ? 1.0 ?? v v t + ?? v cc ? v t ? 0.4 ?? v res , stby , nmi, md 2 to md 0 v cc ? 0.7 ? v cc +0.3 v extal v cc ? v cc +0.3 v port 7 2.0 ? av cc +0.3 v input high voltage ports 1 to 6, 9, p8 4 , p8 3 , pb 7 to pb 4 v ih 2.0 ? v cc +0.3 v res , stby , md 2 to md 0 ? 0.3 ? 0.5 v input low voltage nmi, extal, ports 1 to 7, 9, p8 4 , p8 3 , pb 7 to pb 4 v il ? 0.3 ? 0.8 v v cc ? 0.5 ?? vi oh = ? 200 a output high voltage all output pins (except reso ) v oh 3.5 ?? vi oh = ? 1 ma all output pins (except reso ) ?? 0.4 v i ol = 1.6 ma ports 1, 2, 5, and b ?? 1.0 v i ol = 10 ma output low voltage reso v ol ?? 0.4 i ol = 1.6 ma stby , nmi, res , md 2 to md 0 ?? 1.0 a v in = 0.5 to v cc ? 0.5 v input leakage current port 7 |i in | ?? 1.0 a v in = 0.5 to av cc ? 0.5 v
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 677 of 872 rej09b0325-0300 item symbol min typ max unit test conditions three-state leakage current (off state) ports 1 to 6, 8 to b |i tsi | ?? 1.0 a v in = 0.5 to v cc ? 0.5 v input pull-up mos current ports 2, 4, and 5 ? i p 50 ? 300 a v in = 0 v nmi ?? 50 pf input capacitance all input pins except nmi c in ?? 15 pf v in = 0 v, f = fmin, t a = 25 c normal operation ? 45 60 ma sleep mode ? 35 50 ma module standby mode * 4 ? 20 25 ma f = 25 mhz ? 110 at a c current dissipation * 2 standby mode * 3 i cc * 5 ?? 80 a 50 c < t a during a/d conversion ? 0.5 1.5 ma av cc = 5.0 v during a/d and d/a conversion ? 0.5 1.5 ma analog power supply current idle ai cc ? 0.01 5.0 a daste = 0 during a/d conversion ? 0.4 0.8 ma v ref = 5.0 v during a/d and d/a conversion ? 1.5 3.0 ma reference current idle ai cc ? 0.01 5.0 a daste = 0 ram standby voltage v ram 2.0 ?? v notes: 1. if the a/d and d/a converters are not used, do not leave the av cc , av ss , and v ref pins open. connect av cc and v ref to v cc , and connect av ss to v ss . 2. current dissipation values are for v ih min = v cc ? 0.5 v and v il max = 0.5 v with all output pins unloaded and the on-chip pull-up transistors in the off state. 3. the values are for v ram ? 2) i cc max. (sleep mode) = 7.0 [ma] + 0.26 [ma/(mhz ? 2) i cc max. (sleep mode and module standby mode) = 6.0 [ma] + 0.11 [ma/(mhz ? 2) the typical values of current dissipation are reference values.
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 678 of 872 rej09b0325-0300 table 21.13 dc characteristics (2) conditions: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v * 1 , t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) item symbol min typ max unit test conditions v t ? v cc ?? v v t + ?? v cc ? v t ? v cc ?? v res , stby , nmi, md 2 to md 0 v cc ? v cc +0.3 v extal v cc ? v cc +0.3 v port 7 v cc ? av cc +0.3 v input high voltage ports 1 to 6, 9, p8 4 , p8 3 , pb 7 to pb 4 v ih v cc ? v cc +0.3 v res , stby , md 2 to md 0 ? 0.3 ? v cc ? 0.3 ? v cc ? 0.5 ?? vi oh = ? 200 a output high voltage all output pins (except reso ) v oh v cc ? 1.0 ?? vi oh = ? 1 ma all output pins (except reso ) ?? 0.4 v i ol = 1.6 ma ports 1, 2, 5, and b ?? 1.0 i ol = 5 ma output low voltage reso v ol ?? 0.4 v i ol = 1.6 ma stby , nmi, res , md 2 to md 0 ?? 1.0 a v in = 0.5 to v cc ? 0.5 v input leakage current port 7 |i in | ?? 1.0 a v in = 0.5 to av cc ? 0.5 v
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 679 of 872 rej09b0325-0300 item symbol min typ max unit test conditions three-state leakage current (off state) ports 1 to 6, 8 to b |i tsi | ?? 1.0 a v in = 0.5 to v cc ? 0.5 v input pull-up mos current ports 2, 4, and 5 ? i p 10 ? 300 a v in = 0 v nmi ?? 50 pf input capacitance all input pins except nmi c in ?? 15 pf v in = 0 v, f = fmin, t a = 25 c normal operation ? 40 50 ma sleep mode ? 25 40 ma module standby mode * 4 ? 15 20 ma f = 25 mhz ? 110 at a c current dissipation * 2 standby mode * 3 i cc * 5 ?? 80 a 50 c < t a during a/d conversion ? 0.5 1.5 ma av cc = 3.3 v analog power supply current during a/d and d/a conversion ? 0.5 1.5 ma idle ai cc ? 0.01 5 a daste = 0 during a/d conversion ? 0.4 0.8 ma v ref = 3.3 v during a/d and d/a conversion ? 1.5 3 ma reference current idle ai cc ? 0.01 5 a daste = 0 ram standby voltage v ram 2.0 ?? v notes: 1. if the a/d and d/a converters are not used, do not leave the av cc , av ss , and v ref pins open. connect av cc and v ref to v cc , and connect av ss to v ss . 2. current dissipation values are for v ih min = v cc ? 0.5 v and v il max = 0.5 v with all output pins unloaded and the on-chip pull-up transistors in the off state. 3. the values are for v ram ? 2) i cc max. (sleep mode) = 4.0 [ma] + 0.43 [ma/(mhz ? 2) i cc max. (sleep mode and module standby mode) = 3.0 [ma] + 0.20 [ma/(mhz ? 2) the typical values of current dissipation are reference values.
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 680 of 872 rej09b0325-0300 table 21.14 permissible output currents condition a: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) condition b: v cc = 5.0 v 10%, av cc = 5.0 v 10%, v ref = 4.5 v to av cc , v ss = av ss = 0 v, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) conditions a, b item symbol min typ max unit ports 1, 2, 5, and b ?? 10 ma permissible output low current (per pin) other output pins i ol ?? 2.0 ma total of 28 pins in ports 1, 2, 5, and b ?? 80 ma permissible output low current (total) total of all output pins, including the above ?? 120 ma permissible output high current (per pin) all output pins i oh ?? 2.0 ma permissible output high current (total) total of all output pins ?? 40 ma notes: 1. to protect chip reliability, do not exceed the output current values in table 21.14. 2. when driving a darlington pair or led, always insert a current-limiting resistor in the output line, as shown in figures 21.4 and 21.5.
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 681 of 872 rej09b0325-0300 h8/3048b group port 2 k ? figure 21.4 darlington pair drive circuit (example) h8/3048b group ports 1, 2, 5, and b led 600 ? figure 21.5 led drive circuit (example)
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 682 of 872 rej09b0325-0300 21.2.3 ac characteristics bus timing parameters are listed in table 21.15. refresh controller bus timing parameters are listed in table 21.16. control signal timing parameters are listed in table 21.17. timing parameters of the on-chip supporting modules are listed in table 21.18. table 21.15 bus timing condition a: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) condition b: v cc = 5.0 v 10%, av cc = 5.0 v 10%, v ref = 4.5 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) condition a condition b 25 mhz 25 mhz item symbol min max min max unit test conditions clock cycle time t cyc 40 500 40 500 ns clock pulse low width t cl 10 ? 10 ? clock pulse high width t ch 10 ? 10 ? figure 21.7 figure 21.8 clock rise time t cr ? 10 ? 10 clock fall time t cf ? 10 ? 10 address delay time t ad ? 28 ? 25 address hold time t ah 0.5t cyc ? 20 ? 0.5t cyc ? 20 ? address strobe delay time t asd ? 25 ? 25 write strobe delay time t wsd ? 25 ? 25 strobe delay time t sd ? 25 ? 25 write data strobe pulse width 1 t wsw1 1.0t cyc ? 25 ? 1.0t cyc ? 25 ? write data strobe pulse width 2 t wsw2 1.5t cyc ? 25 ? 1.5t cyc ? 25 ? address setup time 1 t as1 0.5t cyc ? 20 ? 0.5t cyc ? 20 ? address setup time 2 t as2 1.0t cyc ? 20 ? 1.0t cyc ? 20 ? read data setup time t rds 15 ? 15 ? read data hold time t rdh 0 ? 0 ?
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 683 of 872 rej09b0325-0300 condition a condition b 25 mhz 25 mhz item symbol min max min max unit test conditions write data delay time t wdd ? 35 ? 35 ns write data setup time 1 t wds1 1.0t cyc ? 30 ? 1.0t cyc ? 30 ? figure 21.7 figure 21.8 write data setup time 2 t wds2 0.5t cyc ? 30 ? 0.5t cyc ? 30 ? write data hold time t wdh 0.5t cyc ? 15 ? 0.5t cyc ? 15 ? read data access time 1 t acc1 ? 1.5t cyc ? 40 ? 1.5t cyc ? 40 read data access time 2 t acc2 ? 2.5t cyc ? 40 ? 2.5t cyc ? 40 read data access time 3 t acc3 ? 1.0t cyc ? 28 ? 1.0t cyc ? 28 read data access time 4 t acc4 ? 2.0t cyc ? 32 ? 2.0t cyc ? 32 precharge time t pch 1.0t cyc ? 20 ? 1.0t cyc ? 20 ? wait setup time t wts 25 ? 25 ? ns figure 21.9 wait hold time t wth 5 ? 5 ? bus request setup time t brqs 25 ? 25 ? ns figure 21.21 bus acknowledge delay time 1 t bacd1 ? 30 ? 30 bus acknowledge delay time 2 t bacd2 ? 30 ? 30 bus-floating time t bzd ? 40 ? 40
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 684 of 872 rej09b0325-0300 table 21.16 refresh controller bus timing condition a: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) condition b: v cc = 5.0 v 10%, av cc = 5.0 v 10%, v ref = 4.5 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) condition a condition b 25 mhz 25 mhz item symbol min max min max unit test conditions ras delay time 1 * 1 t rad1 ? 20 ? 18 ns ras delay time 2 * 1 t rad2 ? 20 ? 18 ras delay time 3 * 1 t rad3 ? 20 ? 18 row address hold time t rah 0.5t cyc ? 5 ? 0.5t cyc ? 5 ? ras precharge time * 1 t rp 1.0t cyc ? 15 ? 1.0t cyc ? 15 ? cas to ras precharge time * 1 * 2 t crp 1.0t cyc ? 15 ? 1.0t cyc ? 15 ? cas pulse width * 2 t cas 1.0t cyc ? 18 ? 1.0t cyc ? 18 ? ras access time * 1 t rac ? 2.0t cyc ? 35 ? 2.0t cyc ? 35 address access time t aa ? 1.5t cyc ? 40 ? 1.5t cyc ? 40 cas access time * 2 t cac ? 1.0t cyc ? 30 ? 1.0t cyc ? 30 write data setup time 3 t wds3 1.0t cyc ? 25 ? 1.0t cyc ? 25 ? cas setup time * 2 t csr 0.5t cyc ? 15 ? 0.5t cyc ? 15 ? read strobe delay time t rsd ? 25 ? 25 figure 21.10 to figure 21.16 signal rise time (all input pins except extal) t sr ? 100 ? 100 ns figure 21.18 signal fall time (all input pins except extal) t sf ? 100 ? 100 notes: 1. the ras pin is assigned to the cs3 pin. 2. the cas pin is assigned to the rd pin.
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 685 of 872 rej09b0325-0300 table 21.17 control signal timing condition a: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) condition b: v cc = 5.0 v 10%, av cc = 5.0 v 10%, v ref = 4.5 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) condition a condition b 25 mhz 25 mhz item symbol min max min max unit test conditions res setup time t ress 200 ? 200 ? ns figure 21.18 res pulse width t resw 20 ? 20 ? t cyc mode programming setup time t mds 200 ? 200 ? ns reso output delay time t resd ? 50 ? 50 ns figure 21.19 reso output pulse width t resow 132 ? 132 ? t cyc nmi setup time (nmi, irq 5 to irq 0 ) t nmis 150 ? 150 ? ns figure 21.20 nmi hold time (nmi, irq 5 to irq 0 ) t nmih 10 ? 10 ? interrupt pulse width (nmi, irq 2 to irq 0 when exiting software standby mode) t nmiw 200 ? 200 ? clock oscillator settling time at reset (crystal) t osc1 20 ? 20 ? ms figure 21.22 clock oscillator settling time in software standby (crystal) t osc2 7 ? 7 ? ms figure 20.1
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 686 of 872 rej09b0325-0300 table 21.18 timing of on-chip supporting modules condition a: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) condition b: v cc = 5.0 v 10%, av cc = 5.0 v 10%, v ref = 4.5 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) condition a condition b 25 mhz 25 mhz item symbol min max min max unit test conditions dmac dreq setup time t drqs 20 ? 20 ? ns figure 21.30 dreq hold time t drqh 10 ? 10 ? tend delay time 1 t ted1 ? 50 ? 50 tend delay time 2 t ted2 ? 50 ? 50 figures 21.28 and 21.29 itu timer output delay time t tocd ? 50 ? 50 ns figure 21.24 timer input setup time t tics 40 ? 40 ? timer clock input setup time t tcks 40 ? 40 ? figure 21.25 single edge t tckwh 1.5 ? 1.5 ? t cyc timer clock pulse width both edges t tckwl 2.5 ? 2.5 ? sci asynchronous t scyc 4 ? 4 ? t cyc figure 21.26 input clock cycle synchronous t scyc 6 ? 6 ? input clock rise time t sckr ? 1.5 ? 1.5 input clock fall time t sckf ? 1.5 ? 1.5 input clock pulse width t sckw 0.4 0.6 0.4 0.6 t scyc transmit data delay time t txd ? 100 ? 100 ns figure 21.27 receive data setup time (synchronous) t rxs 100 ? 100 ? clock input t rxh 100 ? 100 ? receive data hold time (syn- chronous) clock output t rxh 0 ? 0 ? output data delay time t pwd ? 50 ? 50 ns figure 21.23 input data setup time t prs 50 ? 50 ? ports and tpc input data hold time t prh 50 ? 50 ?
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 687 of 872 rej09b0325-0300 cr h r l h8/3048b group output pin c = 90 pf: ports 4, 5, 6, 8, a (19 to 0), d (15 to 8), reso input/output timing measurement levels  low: 0.8 v  high: 2.0 v r = 2.4 k r = 12 k l h ? ? figure 21.6 output load circuit
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 688 of 872 rej09b0325-0300 21.2.4 a/d conversion characteristics table 21.19 lists the a/d conversion characteristics. table 21.19 a/d converter characteristics condition a: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) condition b: v cc = 5.0 v 10%, av cc = 5.0 v 10%, v ref = 4.5 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) condition a condition b 25 mhz 25 mhz item min typ max min typ max unit resolution 10 10 10 10 10 10 bits conversion time (single mode) 5.36 ?? 5.36 ?? s analog input capacitance ?? 20 ?? 20 pf ?? 10 ?? 10 permissible signal-source impedance > ?? 5 ?? 5 k ? ?? 3.5 ?? 3.5 lsb offset error ?? 3.5 ?? 3.5 lsb full-scale error ?? 3.5 ?? 3.5 lsb quantization error ?? 0.5 ?? 0.5 lsb absolute accuracy ?? 4.0 ?? 4.0 lsb
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 689 of 872 rej09b0325-0300 21.2.5 d/a conversion characteristics table 21.20 lists the d/a conversion characteristics. table 21.20 d/a converter characteristics condition a: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) condition b: v cc = 5.0 v 10%, av cc = 5.0 v 10%, v ref = 4.5 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) condition a condition b 25 mhz 25 mhz item min typ max min typ max unit test conditions resolution 888 888bits conversion time (centering time) ?? 10 ?? 10 s 20-pf capacitive load ? 2.0 3.0 ? 1.5 2.0 lsb 2-m ? ?? 2.0 ?? 1.5 lsb 4-m ?
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 690 of 872 rej09b0325-0300 21.3 operational timing this section shows timing diagrams. 21.3.1 bus timing bus timing is shown as follows: ? basic bus cycle: two-state access figure 21.7 shows the timing of the external two-state access cycle. ? basic bus cycle: three-state access figure 21.8 shows the timing of the external three-state access cycle. ? basic bus cycle: three-state access with one wait state figure 21.9 shows the timing of the external three-state access cycle with one wait state inserted.
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 691 of 872 rej09b0325-0300 t 1 t 2 t ch t cl t ad t cf t cr t as1 t as1 t asd t acc3 t asd t acc3 t acc1 t asd t as1 t wdd t wds1 t wsw1 t sd t ah t pch t sd t ah t pch t rdh t rds t pch t sd t ah t wdh cs to cs as rd (read) d 15 to d 0 (read) hwr , lwr (write) d 15 to d 0 (write) 70 t cyc t cyc figure 21.7 basic bus cycle: two-state access
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 692 of 872 rej09b0325-0300 t 1 t 2 t 3 t acc4 t acc4 t acc2 t wsw2 t wsd t as2 t wds2 as rd (read) d 15 to d 0 (read) hwr , lwr (write) d 15 to d 0 (write) t rds figure 21.8 basic bus cycle: three-state access
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 693 of 872 rej09b0325-0300 t 1 t 2 t w t 3 t wts t wts t wth as rd (read) d 15 to d 0 (read) hwr , lwr (write) d 15 to d 0 (write) wait t wth figure 21.9 basic bus cycle: three-state access with one wait state
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 694 of 872 rej09b0325-0300 21.3.2 refresh controller bus timing refresh controller bus timing is shown as follows: ? dram bus timing figures 21.10 to 21.15 show the dram bus timing in each operating mode. ? psram bus timing figures 21.16 and 21.17 show the pseudo-static ram bus timing in each operating mode. as cs ( ras ) rd ( cas ) hwr ( uw ), lwr ( ) lw (read) hwr ( uw ), lwr ( ) lw (write) rfsh d 15 to d 0 (read) d 15 to d 0 (write) t 1 t 2 t 3 t ad t ad t rah t rad1 t as1 t asd t as1 t rac t asd t aa t cac t rad3 t rp t sd t crp t sd t wdh t rds t rdh t wds3 t cas 3 figure 21.10 dram bus timing (read/write): three-state access ? 2 we we we we mode ?
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 695 of 872 rej09b0325-0300 as cs 3 ( ras ) rd ( cas ) hwr ( uw ), lwr ( lw ) rfsh t 1 t 2 t 3 t asd t csr t asd t rad2 t rad2 t csr t rad3 t sd t rad3 t sd figure 21.11 dram bus timing (refresh cycle): three-state access ? 2 we we we we mode ? cs ( ras ) rd ( cas ) rfsh t csr t csr 3 figure 21.12 dram bus timing (self-refresh mode) ? 2 we we we we mode ?
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 696 of 872 rej09b0325-0300 ) t 1 t 2 t 3 t ad t ad t rah t rad1 t as1 t asd t as1 t aa t rac t asd t cac t wds3 t rds t wdh t rdh t sd t sd t rad3 t crp t rp t cas rfsh as cs ( ras hwr ( ucas ), lwr ( lcas ) rd ( we ) (read) rd ( we ) (write) d 15 to d 0 (read) (write) d 15 to d 0 3 figure 21.13 dram bus timing (read/write): three-state access ? 2 cas cas cas cas mode ?
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 697 of 872 rej09b0325-0300 as cs ( ras ) rd ( we ) hwr ( ucas ), lwr ( lcas ) rfsh t 1 t 2 t 3 t asd t csr t asd t rad2 t rad2 t csr t rad3 t sd t rad3 t sd 3 figure 21.14 dram bus timing (refresh cycle): three-state access ? 2 cas cas cas cas mode ? t csr t csr ucas cs ( ras ) hwr lwr ( ( ), rfsh lcas ) 3 figure 21.15 dram bus timing (self-refresh mode) ? 2 cas cas cas cas mode ?
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 698 of 872 rej09b0325-0300 as cs 3 rd (read) d 15 to d 0 (read) hwr , lwr (write) d 15 to d 0 (write) rfsh t ad t 2 t 3 t rad1 t as1 t rsd t wsd t wds2 t rad3 t rp t rdh t sd t rds t sd t 1 figure 21.16 psram bus timing (read/write): three-state access as cs 3 hwr , lwr , rd rfsh t 2 t 3 t 1 t rad2 t rad3 figure 21.17 psram bus timing (refresh cycle): three-state access
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 699 of 872 rej09b0325-0300 21.3.3 control signal timing control signal timing is shown as follows: ? reset input timing figure 21.18 shows the reset input timing. ? reset output timing figure 21.19 shows the reset output timing. ? interrupt input timing figure 21.20 shows the input timing for nmi and irq 5 to irq 0 . ? bus-release mode timing figure 21.21 shows the bus-release mode timing. res md 2 to md 0 figure 21.18 reset input timing reso t resd t resow t resd figure 21.19 reset output timing * note: * this is a function for models with on-chip mask rom (h8/3048b, h8/3048, h8/3047, h8/3045, and h8/3044), prom (h8/3048ztat), and on-chip flash memory with a dual power supply (h8/3048f). the function does not exist in the product with on-chip flash memory with a single power supply (h8/3048f-one).
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 700 of 872 rej09b0325-0300 irq irq e l t nmis t nmih t nmis t nmih t nmis t nmiw nmi irq j irq : edge-sensitive irq : level-sensitive irq (i = 0 to 5) e l i i irq (j = 0 to 2) figure 21.20 interrupt input timing breq back as , rd , hwr , lwr t brqs t brqs t bacd1 t bzd t bacd2 t bzd figure 21.21 bus-release mode timing
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 701 of 872 rej09b0325-0300 21.3.4 clock timing clock timing is shown as follows: ? oscillator settling timing figure 21.22 shows the oscillator settling timing. stby res t osc1 t osc1 figure 21.22 oscillator settling timing 21.3.5 tpc and i/o port timing figure 21.23 shows the tpc and i/o port timing. t 1 t 2 t 3 figure 21.23 tpc and i/o port input/output timing
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 702 of 872 rej09b0325-0300 21.3.6 itu timing itu timing is shown as follows: ? itu input/output timing figure 21.24 shows the itu input/output timing. ? itu external clock input timing figure 21.25 shows the itu external clock input timing. figure 21.24 itu input/output timing figure 21.25 itu external clock input timing
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 703 of 872 rej09b0325-0300 21.3.7 sci input/output timing sci timing is shown as follows: ? sci input clock timing figure 21.26 shows the sck input clock timing. ? sci input/output timing (synchronous mode) figure 21.27 shows the sci input/output timing in synchronous mode. sck0, sck1 t sckw t scyc t sckr t sckf figure 21.26 sck input clock timing t scyc t txd t rxs t rxh sck0, sck1 txd0, txd1 (transmit data) rxd0, rxd1 (receive data) figure 21.27 sci input/output timing in synchronous mode
section 21 electrical characteristics rev. 3.00 sep 27, 2006 page 704 of 872 rej09b0325-0300 21.3.8 dmac timing dmac timing is shown as follows. ? dmac tend output timing for 2 state access figure 21.28 shows the dmac tend output timing for 2 state access. ? dmac tend output timing for 3 state access figure 21.29 shows the dmac tend output timing for 3 state access. ? dmac dreq input timing figure 21.30 shows dmac dreq input timing. t 1 t 2 t ted1 t ted2 tend figure 21.28 dmac tend tend tend tend output timing for 2 state access t 1 t 2 t 3 t ted1 t ted2 tend figure 21.29 dmac tend tend tend tend output timing for 3 state access t drqh t drqs dreq figure 21.30 dmac dreq dreq dreq dreq input timing
appendix a instruction set rev. 3.00 sep 27, 2006 page 705 of 872 rej09b0325-0300 appendix a instruction set a.1 instruction list operand notation symbol description rd general destination register rs general source register rn general register erd general destination register (address register or 32-bit register) ers general source register (address register or 32-bit register) ern general register (32-bit register) (ead) destination operand (eas) source operand pc program counter sp stack pointer ccr condition code register n n (negative) flag in ccr z z (zero) flag in ccr v v (overflow) flag in ccr c c (carry) flag in ccr disp displacement transfer from the operand on the left to the operand on the right, or transition from the state on the left to the state on the right + addition of the operands on both sides ? subtraction of the operand on the right from the operand on the left multiplication of the operands on both sides division of the operand on the left by the operand on the right logical and of the operands on both sides logical or of the operands on both sides exclusive logical or of the operands on both sides ? not (logical complement) ( ), < > contents of operand note: general registers include 8-bit registers (r0h to r7h and r0l to r7l) and 16-bit registers (r0 to r7 and e0 to e7).
appendix a instruction set rev. 3.00 sep 27, 2006 page 706 of 872 rej09b0325-0300 condition code notation symbol description ? changed according to execution result * undetermined (no guaranteed value) 0 cleared to 0 1 set to 1 ? not affected by execution of the instruction ? varies depending on conditions, described in notes
appendix a instruction set rev. 3.00 sep 27, 2006 page 707 of 872 rej09b0325-0300 table a.1 instruction set 1. data transfer instructions mnemonic operation operand size addressing mode and instruction length (bytes) no. of states * 1 condition code ihnzvc #xx rn @ern @(d, ern) @ ? ern/@ern+ @aa @(d, pc) @@aa ? mov.b #xx:8, rd mov.b rs, rd mov.b @ers, rd mov.b @(d:16, ers), rd mov.b @(d:24, ers), rd mov.b @ers+, rd mov.b @aa:8, rd mov.b @aa:16, rd mov.b @aa:24, rd mov.b rs, @erd mov.b rs, @(d:16, erd) mov.b rs, @(d:24, erd) mov.b rs, @ ? erd mov.b rs, @aa:8 mov.b rs, @aa:16 mov.b rs, @aa:24 mov.w #xx:16, rd mov.w rs, rd mov.w @ers, rd mov.w @(d:16, ers), rd mov.w @(d:24, ers), rd mov.w @ers+, rd mov.w @aa:16, rd mov.w @aa:24, rd mov.w rs, @erd mov.w rs, @(d:16, erd) mov.w rs, @(d:24, erd) #xx:8 rd8 rs8 rd8 @ers rd8 @(d:16, ers) rd8 @(d:24, ers) rd8 @ers rd8, ers32+1 ers32 @aa:8 rd8 @aa:16 rd8 @aa:24 rd8 rs8 @erd rs8 @(d:16, erd) rs8 @(d:24, erd) erd32 ? 1 erd32, rs8 @erd rs8 @aa:8 rs8 @aa:16 rs8 @aa:24 #xx:16 rd16 rs16 rd16 @ers rd16 @(d:16, ers) rd16 @(d:24, ers) rd16 @ers rd16, ers32+2 @erd32 @aa:16 rd16 @aa:24 rd16 rs16 @erd rs16 @(d:16, erd) rs16 @(d:24, erd) b b b b b b b b b b b b b b b b w w w w w w w w w w w 2 4 2 2 2 2 2 2 4 8 4 8 4 8 4 8 2 2 2 2 4 6 2 4 6 4 6 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 4 6 10 6 4 6 8 4 6 10 6 4 6 8 4 2 4 6 10 6 6 8 4 6 10 normal advanced ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
appendix a instruction set rev. 3.00 sep 27, 2006 page 708 of 872 rej09b0325-0300 mnemonic operation operand size addressing mode and instruction length (bytes) no. of states * 1 condition code ihnzvc #xx rn @ern @(d, ern) @ ? ern/@ern+ @aa @(d, pc) @@aa ? mov.w rs, @ ? erd mov.w rs, @aa:16 mov.w rs, @aa:24 mov.l #xx:32, rd mov.l ers, erd mov.l @ers, erd mov.l @(d:16, ers), erd mov.l @(d:24, ers), erd mov.l @ers+, erd mov.l @aa:16, erd mov.l @aa:24, erd mov.l ers, @erd mov.l ers, @(d:16, erd) mov.l ers, @(d:24, erd) mov.l ers, @ ? erd mov.l ers, @aa:16 mov.l ers, @aa:24 pop.w rn pop.l ern push.w rn push.l ern movfpe @aa:16, rd movtpe rs, @aa:16 erd32 ? 2 erd32, rs16 @erd rs16 @aa:16 rs16 @aa:24 #xx:32 rd32 ers32 erd32 @ers erd32 @(d:16, ers) erd32 @(d:24, ers) erd32 @ers erd32, ers32+4 ers32 @aa:16 erd32 @aa:24 erd32 ers32 @erd ers32 @(d:16, erd) ers32 @(d:24, erd) erd32 ? 4 erd32, ers32 @erd ers32 @aa:16 ers32 @aa:24 @sp rn16, sp+2 sp @sp ern32, sp+4 sp sp ? 2 sp, rn16 @sp sp ? 4 sp, ern32 @sp cannot be used in the h8/3048b group cannot be used in the h8/3048b group w w w l l l l l l l l l l l l l l w l w l b b 6 2 4 4 6 10 6 10 2 4 4 4 6 6 8 6 8 4 4 2 4 2 4 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 6 8 6 2 8 10 14 10 10 12 8 10 14 10 10 12 6 10 6 10 normal advanced ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cannot be used in the h8/3048b group cannot be used in the h8/3048b group
appendix a instruction set rev. 3.00 sep 27, 2006 page 709 of 872 rej09b0325-0300 2. arithmetic instructions mnemonic operation operand size addressing mode and instruction length (bytes) no. of states * 1 condition code ihnzvc #xx rn @ern @(d, ern) @ ? ern/@ern+ @aa @(d, pc) @@aa ? add.b #xx:8, rd add.b rs, rd add.w #xx:16, rd add.w rs, rd add.l #xx:32, erd add.l ers, erd addx.b #xx:8, rd addx.b rs, rd adds.l #1, erd adds.l #2, erd adds.l #4, erd inc.b rd inc.w #1, rd inc.w #2, rd inc.l #1, erd inc.l #2, erd daa rd sub.b rs, rd sub.w #xx:16, rd sub.w rs, rd sub.l #xx:32, erd sub.l ers, erd subx.b #xx:8, rd subx.b rs, rd subs.l #1, erd subs.l #2, erd subs.l #4, erd dec.b rd dec.w #1, rd dec.w #2, rd rd8+#xx:8 rd8 rd8+rs8 rd8 rd16+#xx:16 rd16 rd16+rs16 rd16 erd32+#xx:32 erd32 erd32+ers32 erd32 rd8+#xx:8 +c rd8 rd8+rs8 +c rd8 erd32+1 erd32 erd32+2 erd32 erd32+4 erd32 rd8+1 rd8 rd16+1 rd16 rd16+2 rd16 erd32+1 erd32 erd32+2 erd32 rd8 decimal adjust rd8 rd8 ? rs8 rd8 rd16 ? #xx:16 rd16 rd16 ? rs16 rd16 erd32 ? #xx:32 erd32 erd32 ? ers32 erd32 rd8 ? #xx:8 ? c rd8 rd8 ? rs8 ? c rd8 erd32 ? 1 erd32 erd32 ? 2 erd32 erd32 ? 4 erd32 rd8 ? 1 rd8 rd16 ? 1 rd16 rd16 ? 2 rd16 b b w w l l b b l l l b w w l l b b w w l l b b l l l b w w 2 4 6 2 4 6 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (1) (1) (2) (2) ? ? ? ? ? ? ? ? * (1) (1) (2) (2) ? ? ? ? ? ? 2 2 4 2 6 2 2 2 2 2 2 2 2 2 2 2 2 2 4 2 6 2 2 2 2 2 2 2 2 2 normal advanced ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (3) (3) ? ? ? (3) (3) ? ? ? ? ? ? ? ? ?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? * ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
appendix a instruction set rev. 3.00 sep 27, 2006 page 710 of 872 rej09b0325-0300 mnemonic operation operand size addressing mode and instruction length (bytes) no. of states * 1 condition code ihnzvc #xx rn @ern @(d, ern) @ ? ern/@ern+ @aa @(d, pc) @@aa ? dec.l #1, erd dec.l #2, erd das.rd mulxu. b rs, rd mulxu. w rs, erd mulxs. b rs, rd mulxs. w rs, erd divxu. b rs, rd divxu. w rs, erd divxs. b rs, rd divxs. w rs, erd cmp.b #xx:8, rd cmp.b rs, rd cmp.w #xx:16, rd cmp.w rs, rd cmp.l #xx:32, erd cmp.l ers, erd erd32 ? 1 erd32 erd32 ? 2 erd32 rd8 decimal adjust rd8 rd8 rs8 rd16 (unsigned multiplication) rd16 rs16 erd32 (unsigned multiplication) rd8 rs8 rd16 (signed multiplication) rd16 rs16 erd32 (signed multiplication) rd16 rs8 rd16 (rdh: remainder, rdl: quotient) (unsigned division) erd32 rs16 erd32 (ed: remainder, rd: quotient) (unsigned division) rd16 rs8 rd16 (rdh: remainder, rdl: quotient) (signed division) erd32 rs16 erd32 (ed: remainder, rd: quotient) (signed division) rd8 ? #xx:8 rd8 ? rs8 rd16 ? #xx:16 rd16 ? rs16 erd32 ? #xx:32 erd32 ? ers32 l l b b w b w b w b w b b w w l l 2 4 6 2 2 2 2 2 4 4 2 2 4 4 2 2 2 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 2 2 2 14 22 16 24 14 22 16 24 2 2 4 2 4 2 normal advanced ? ? ? ? ? * ? ? ? ? ? ? ? ? (1) (1) (2) (2) ? ? ? ? ? * ? ? ? ? ? ? ? ? ? ? (7) (7) (7) (7) ? ? (6) (6) (8) (8) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
appendix a instruction set rev. 3.00 sep 27, 2006 page 711 of 872 rej09b0325-0300 mnemonic operation operand size addressing mode and instruction length (bytes) no. of states * 1 condition code ihnzvc #xx rn @ern @(d, ern) @ ? ern/@ern+ @aa @(d, pc) @@aa ? neg.b rd neg.w rd neg.l erd extu.w rd extu.l erd exts.w rd exts.l erd 0 ? rd8 rd8 0 ? rd16 rd16 0 ? erd32 erd32 0 ( of rd16) 0 ( of erd32) ( of rd16) ( of rd16) ( of erd32) ( of erd32) b w l w l w l 2 2 2 2 2 2 2 ? ? ? ? ? ? ? ? ? ? ? 2 2 2 2 2 2 2 normal advanced ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0 0 0 0 0 0 ? ? ? ? ? ? ? ? ? ?
appendix a instruction set rev. 3.00 sep 27, 2006 page 712 of 872 rej09b0325-0300 3. logic instructions mnemonic operation operand size addressing mode and instruction length (bytes) no. of states * 1 condition code ihnzvc #xx rn @ern @(d, ern) @ ? ern/@ern+ @aa @(d, pc) @@aa ? and.b #xx:8, rd and.b rs, rd and.w #xx:16, rd and.w rs, rd and.l #xx:32, erd and.l ers, erd or.b #xx:8, rd or.b rs, rd or.w #xx:16, rd or.w rs, rd or.l #xx:32, erd or.l ers, erd xor.b #xx:8, rd xor.b rs, rd xor.w #xx:16, rd xor.w rs, rd xor.l #xx:32, erd xor.l ers, erd not.b rd not.w rd not.l erd rd8 #xx:8 rd8 rd8 rs8 rd8 rd16 #xx:16 rd16 rd16 rs16 rd16 erd32 #xx:32 erd32 erd32 ers32 erd32 rd8 #xx:8 rd8 rd8 rs8 rd8 rd16 #xx:16 rd16 rd16 rs16 rd16 erd32 #xx:32 erd32 erd32 ers32 erd32 rd8 #xx:8 rd8 rd8 rs8 rd8 rd16 #xx:16 rd16 rd16 rs16 rd16 erd32 #xx:32 erd32 erd32 ers32 erd32 ? rd8 rd8 ? rd16 rd16 ? rd32 rd32 b b w w l l b b w w l l b b w w l l b w l 2 4 6 2 4 6 2 4 6 2 2 4 2 2 4 2 2 4 2 2 2 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 4 2 6 4 2 2 4 2 6 4 2 2 4 2 6 4 2 2 2 normal advanced ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
appendix a instruction set rev. 3.00 sep 27, 2006 page 713 of 872 rej09b0325-0300 4. shift instructions mnemonic operation operand size addressing mode and instruction length (bytes) no. of states * 1 condition code ihnzvc #xx rn @ern @(d, ern) @ ? ern/@ern+ @aa @(d, pc) @@aa ? shal.b rd shal.w rd shal.l erd shar.b rd shar.w rd shar.l erd shll.b rd shll.w rd shll.l erd shlr.b rd shlr.w rd shlr.l erd rotxl.b rd rotxl.w rd rotxl.l erd rotxr.b rd rotxr.w rd rotxr.l erd rotl.b rd rotl.w rd rotl.l erd rotr.b rd rotr.w rd rotr.l erd b w l b w l b w l b w l b w l b w l b w l b w l 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 normal advanced ? ? ? ? msb lsb 0 c msb lsb 0 c c msb lsb 0c msb lsb c msb lsb c msb lsb c msb lsb c msb lsb ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
appendix a instruction set rev. 3.00 sep 27, 2006 page 714 of 872 rej09b0325-0300 5. bit manipulation instructions mnemonic operation operand size addressing mode and instruction length (bytes) no. of states * 1 condition code ihnzvc #xx rn @ern @(d, ern) @ ? ern/@ern+ @aa @(d, pc) @@aa ? bset #xx:3, rd bset #xx:3, @erd bset #xx:3, @aa:8 bset rn, rd bset rn, @erd bset rn, @aa:8 bclr #xx:3, rd bclr #xx:3, @erd bclr #xx:3, @aa:8 bclr rn, rd bclr rn, @erd bclr rn, @aa:8 bnot #xx:3, rd bnot #xx:3, @erd bnot #xx:3, @aa:8 bnot rn, rd bnot rn, @erd bnot rn, @aa:8 btst #xx:3, rd btst #xx:3, @erd btst #xx:3, @aa:8 btst rn, rd btst rn, @erd btst rn, @aa:8 bld #xx:3, rd (#xx:3 of rd8) 1 (#xx:3 of @erd) 1 (#xx:3 of @aa:8) 1 (rn8 of rd8) 1 (rn8 of @erd) 1 (rn8 of @aa:8) 1 (#xx:3 of rd8) 0 (#xx:3 of @erd) 0 (#xx:3 of @aa:8) 0 (rn8 of rd8) 0 (rn8 of @erd) 0 (rn8 of @aa:8) 0 (#xx:3 of rd8) ? (#xx:3 of rd8) (#xx:3 of @erd) ? (#xx:3 of @erd) (#xx:3 of @aa:8) ? (#xx:3 of @aa:8) (rn8 of rd8) ? (rn8 of rd8) (rn8 of @erd) ? (rn8 of @erd) (rn8 of @aa:8) ? (rn8 of @aa:8) ? (#xx:3 of rd8) z ? (#xx:3 of @erd) z ? (#xx:3 of @aa:8) z ? (rn8 of @rd8) z ? (rn8 of @erd) z ? (rn8 of @aa:8) z (#xx:3 of rd8) c b b b b b b b b b b b b b b b b b b b b b b b b b 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 2 8 8 2 8 8 2 8 8 2 8 8 2 8 8 2 8 8 2 6 6 2 6 6 2 normal advanced ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
appendix a instruction set rev. 3.00 sep 27, 2006 page 715 of 872 rej09b0325-0300 mnemonic operation operand size addressing mode and instruction length (bytes) no. of states * 1 condition code ihnzvc #xx rn @ern @(d, ern) @ ? ern/@ern+ @aa @(d, pc) @@aa ? bld #xx:3, @erd bld #xx:3, @aa:8 bild #xx:3, rd bild #xx:3, @erd bild #xx:3, @aa:8 bst #xx:3, rd bst #xx:3, @erd bst #xx:3, @aa:8 bist #xx:3, rd bist #xx:3, @erd bist #xx:3, @aa:8 band #xx:3, rd band #xx:3, @erd band #xx:3, @aa:8 biand #xx:3, rd biand #xx:3, @erd biand #xx:3, @aa:8 bor #xx:3, rd bor #xx:3, @erd bor #xx:3, @aa:8 bior #xx:3, rd bior #xx:3, @erd bior #xx:3, @aa:8 bxor #xx:3, rd bxor #xx:3, @erd bxor #xx:3, @aa:8 bixor #xx:3, rd bixor #xx:3, @erd bixor #xx:3, @aa:8 (#xx:3 of @erd) c (#xx:3 of @aa:8) c ? (#xx:3 of rd8) c ? (#xx:3 of @erd) c ? (#xx:3 of @aa:8) c c (#xx:3 of rd8) c (#xx:3 of @erd24) c (#xx:3 of @aa:8) ? c (#xx:3 of rd8) ? c (#xx:3 of @erd24) ? c (#xx:3 of @aa:8) c (#xx:3 of rd8) c c (#xx:3 of @erd24) c c (#xx:3 of @aa:8) c c ? (#xx:3 of rd8) c c ? (#xx:3 of @erd24) c c ? (#xx:3 of @aa:8) c c (#xx:3 of rd8) c c (#xx:3 of @erd24) c c (#xx:3 of @aa:8) c c ? (#xx:3 of rd8) c c ? (#xx:3 of @erd24) c c ? (#xx:3 of @aa:8) c c (#xx:3 of rd8) c c (#xx:3 of @erd24) c c (#xx:3 of @aa:8) c c ? (#xx:3 of rd8) c c ? (#xx:3 of @erd24) c c ? (#xx:3 of @aa:8) c b b b b b b b b b b b b b b b b b b b b b b b b b b b b b 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 6 6 2 6 6 2 8 8 2 8 8 2 6 6 2 6 6 2 6 6 2 6 6 2 6 6 2 6 6 normal advanced ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
appendix a instruction set rev. 3.00 sep 27, 2006 page 716 of 872 rej09b0325-0300 6. branching instructions ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mnemonic operation operand size addressing mode and instruction length (bytes) no. of states * 1 condition code ihnzvc #xx rn @ern @(d, ern) @ ? ern/@ern+ @aa @(d, pc) @@aa ? bra d:8 (bt d:8) bra d:16 (bt d:16) brn d:8 (bf d:8) brn d:16 (bf d:16) bhi d:8 bhi d:16 bls d:8 bls d:16 bcc d:8 (bhs d:8) bcc d:16 (bhs d:16) bcs d:8 (blo d:8) bcs d:16 (blo d:16) bne d:8 bne d:16 beq d:8 beq d:16 bvc d:8 bvc d:16 bvs d:8 bvs d:16 bpl d:8 bpl d:16 bmi d:8 bmi d:16 bge d:8 bge d:16 blt d:8 blt d:16 bgt d:8 bgt d:16 ble d:8 ble d:16 always never c z = 0 c z = 1 c = 0 c = 1 z = 0 z = 1 v = 0 v = 1 n = 0 n = 1 n v = 0 n v = 1 z (n v) = 0 z (n v) = 1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 4 6 4 6 4 6 4 6 4 6 4 6 4 6 4 6 4 6 4 6 4 6 4 6 4 6 4 6 4 6 4 6 normal advanced if condition is true then pc pc+d else next; branch condition
appendix a instruction set rev. 3.00 sep 27, 2006 page 717 of 872 rej09b0325-0300 mnemonic operation operand size addressing mode and instruction length (bytes) no. of states * 1 condition code ihnzvc #xx rn @ern @(d, ern) @ ? ern/@ern+ @aa @(d, pc) @@aa ? jmp @ern jmp @aa:24 jmp @@aa:8 bsr d:8 bsr d:16 jsr @ern jsr @aa:24 jsr @@aa:8 rts pc ern pc aa:24 pc @aa:8 pc @ ? sp pc pc+d:8 pc @ ? sp pc pc+d:16 pc @ ? sp pc @ern pc @ ? sp pc @aa:24 pc @ ? sp pc @aa:8 pc @sp+ ? ? ? ? ? ? ? ? ? 2 2 4 4 2 4 2 2 2 ? ? ? ? ? ? ? ? ? 4 6 normal advanced ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 8 6 8 6 8 8 8 10 8 10 8 10 12 10
appendix a instruction set rev. 3.00 sep 27, 2006 page 718 of 872 rej09b0325-0300 7. system control instructions mnemonic operation operand size addressing mode and instruction length (bytes) no. of states * 1 condition code ihnzvc #xx rn @ern @(d, ern) @ ? ern/@ern+ @aa @(d, pc) @@aa ? trapa #x:2 rte sleep ldc #xx:8, ccr ldc rs, ccr ldc @ers, ccr ldc @(d:16, ers), ccr ldc @(d:24, ers), ccr ldc @ers+, ccr ldc @aa:16, ccr ldc @aa:24, ccr stc ccr, rd stc ccr, @erd stc ccr, @(d:16, erd) stc ccr, @(d:24, erd) stc ccr, @ ? erd stc ccr, @aa:16 stc ccr, @aa:24 andc #xx:8, ccr orc #xx:8, ccr xorc #xx:8, ccr nop pc @ ? sp, ccr @ ? sp, pc ccr @sp+, pc @sp+ transition to power- down state #xx:8 ccr rs8 ccr @ers ccr @(d:16, ers) ccr @(d:24, ers) ccr @ers ccr, ers32+2 ers32 @aa:16 ccr @aa:24 ccr ccr rd8 ccr @erd ccr @(d:16, erd) ccr @(d:24, erd) erd32 ? 2 erd32, ccr @erd ccr @aa:16 ccr @aa:24 ccr #xx:8 ccr ccr #xx:8 ccr ccr #xx:8 ccr pc pc+2 ? ? ? b b w w w w w w b w w w w w w b b b ? 2 2 2 2 2 2 4 4 6 10 6 10 4 4 6 8 6 8 2 2 1 ? ? ? ? ? ? ? ? ? 10 2 2 2 6 8 12 8 8 10 2 6 8 12 8 8 10 2 2 2 2 normal advanced ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 14 16
appendix a instruction set rev. 3.00 sep 27, 2006 page 719 of 872 rej09b0325-0300 8. block transfer instructions mnemonic operation operand size addressing mode and instruction length (bytes) no. of states * 1 condition code ihnzvc #xx rn @ern @(d, ern) @ ? ern/@ern+ @aa @(d, pc) @@aa ? eepmov. b eepmov. w if r4l 0 then repeat @r5 @r6 r5+1 r5 r6+1 r6 r4l ? 1 r4l until r4l=0 else next if r4 0 then repeat @r5 @r6 r5+1 r5 r6+1 r6 r4 ? 1 r4 until r4=0 else next ? ? 4 4 ? ? 8+ 4n * 2 normal advanced ? ? ? ? ? ? ? ? ? ? 8+ 4n * 2 notes: 1. the number of states is the number of states required for execution when the instruction and its operands are located in on-chip memory. for other cases see section a.3, number of states required for executi on. 2. n is the value set in register r4l or r4. (1) set to 1 when a carry or borrow occurs at bit 11; otherwise cleared to 0. (2) set to 1 when a carry or borrow occurs at bit 27; otherwise cleared to 0. (3) retains its previous value when the result is zero; otherwise cleared to 0. (4) set to 1 when the adjustment produces a carry; otherwise retains its previous value. (5) the number of states required for execution of an instruction that transfers data in synchronization with the e clock is variable. (6) set to 1 when the divisor is negative; otherwise cleared to 0. (7) set to 1 when the divisor is zero; otherwise cleared to 0. (8) set to 1 when the quotient is negative; otherwise cleared to 0.
appendix a instruction set rev. 3.00 sep 27, 2006 page 720 of 872 rej09b0325-0300 a.2 operation code map table a.2 operation code map ah al 0123456789abcdef 0 1 2 3 4 5 6 7 8 9 a b c d e f nop bra mulxu bset brn divxu bnot stc bhi mulxu bclr ldc bls divxu btst orc or.b bcc rts or xorc xor.b bcs bsr xor bor bior bxor bixor band biand andc and.b bne rte and ldc beq trapa bld bild bst bist bvc mov bpl jmp bmi eepmov addx subx bgt jsr ble mov add addx cmp subx or xor and mov instruction when most significant bit of bh is 0. instruction when most significant bit of bh is 1. instruction code: table a.2 (2) table a.2 (2) table a.2 (2) table a.2 (2) table a.2 (2) bvs blt bge bsr table a.2 (2) table a.2 (2) table a.2 (2) table a.2 (2) table a.2 (2) table a.2 (2) table a.2 (2) table a.2 (2) table a.2 (2) table a.2 (2) table a.2 (3) 1st byte 2nd byte ah bh al bl add sub mov cmp mov.b
appendix a instruction set rev. 3.00 sep 27, 2006 page 721 of 872 rej09b0325-0300 ah al bh 0123456789abcdef 01 0a 0b 0f 10 11 12 13 17 1a 1b 1f 58 79 7a mov inc adds daa dec subs das bra mov mov bhi cmp cmp ldc/stc bcc or or bpl bgt instruction code: bvs sleep bvc bge table a.2 (3) table a.2 (3) table a.2 (3) add mov sub cmp bne and and inc extu dec beq inc extu dec bcs xor xor shll shlr rotxl rotxr not bls sub sub brn add add inc exts dec blt inc exts dec ble shal shar rotl rotr neg bmi 1st byte 2nd byte ah bh al bl subs adds shll shlr rotxl rotxr not shal shar rotl rotr neg
appendix a instruction set rev. 3.00 sep 27, 2006 page 722 of 872 rej09b0325-0300 ah albh blch cl 0123456789abcdef 01406 01c05 01d05 01f06 7cr06 7cr07 7dr06 7dr07 7eaa6 7eaa7 7faa6 7faa7 mulxs bset bset bset bset divxs bnot bnot bnot bnot mulxs bclr bclr bclr bclr divxs btst btst btst btst or xor bor bior bxor bixor band biand and bld bild bst bist instruction when most significant bit of dh is 0. instruction when most significant bit of dh is 1. instruction code: * 1 * 1 * 1 * 1 * 2 * 2 * 2 * 2 bor bior bxor bixor band biand bld bild bst bist notes: 1. 2. r is the register designation field. aa is the absolute address field. 1st byte 2nd byte ah bh al bl 3rd byte ch dh cl dl 4th byte ldc stc ldc ldc ldc stc stc stc
appendix a instruction set rev. 3.00 sep 27, 2006 page 723 of 872 rej09b0325-0300 a.3 number of states required for execution the tables in this section can be used to calculate the number of states required for instruction execution by the h8/300h cpu. table a.4 indicates the number of instruction fetch, data read/write, and other cycles occurring in each instruction. table a.3 indicates the number of states required per cycle according to the bus size. the number of states required for execution of an instruction can be calculated from these two tables as follows: number of states = i examples of calculation of number of states required for execution examples: advanced mode, stack located in external address space, on-chip supporting modules accessed with 8-bit bus width, external devices accessed in three states with one wait state and 16-bit bus width. bset #0, @ffffc7:8 from table a.4, i = l = 2 and j = k = m = n = 0 from table a.3, s i = 4 and s l = 3 number of states = 2
appendix a instruction set rev. 3.00 sep 27, 2006 page 724 of 872 rej09b0325-0300 table a.3 number of states per cycle access conditions external device on-chip supporting module 8-bit bus 16-bit bus cycle on-chip memory 8-bit bus 16-bit bus 2-state access 3-state access 2-state access 3-state access instruction fetch s i 2 6 3 4 6 + 2m 2 3 + m branch address read s j stack operation s k byte data access s l 323 + m word data access s m 6 4 6 + 2m internal operation s n 11111 11 legend: m: number of wait states inserted into external device access
appendix a instruction set rev. 3.00 sep 27, 2006 page 725 of 872 rej09b0325-0300 table a.4 number of cycles per instruction instruction mnemonic instruction fetch i branch addr. read j stack operation k byte data access l word data access m internal operation n add add.b #xx:8, rd 1 add.b rs, rd 1 add.w #xx:16, rd 2 add.w rs, rd 1 add.l #xx:32, erd 3 add.l ers, erd 1 adds adds #1/2/4, erd 1 addx addx #xx:8, rd 1 addx rs, rd 1 and and.b #xx:8, rd 1 and.b rs, rd 1 and.w #xx:16, rd 2 and.w rs, rd 1 and.l #xx:32, erd 3 and.l ers, erd 2 andc andc #xx:8, ccr 1 band band #xx:3, rd 1 band #xx:3, @erd 2 1 band #xx:3, @aa:8 2 1 bcc bra d:8 (bt d:8) 2 brn d:8 (bf d:8) 2 bhi d:8 2 bls d:8 2 bcc d:8 (bhs d:8) 2 bcs d:8 (blo d:8) 2 bne d:8 2 beq d:8 2 bvc d:8 2 bvs d:8 2 bpl d:8 2 bmi d:8 2
appendix a instruction set rev. 3.00 sep 27, 2006 page 726 of 872 rej09b0325-0300 instruction mnemonic instruction fetch i branch addr. read j stack operation k byte data access l word data access m internal operation n bcc bge d:8 2 blt d:8 2 bgt d:8 2 ble d:8 2 bra d:16 (bt d:16) 2 2 brn d:16 (bf d:16) 2 2 bhi d:16 2 2 bls d:16 2 2 bcc d:16 (bhs d:16) 2 2 bcs d:16 (blo d:16) 2 2 bne d:16 2 2 beq d:16 2 2 bvc d:16 2 2 bvs d:16 2 2 bpl d:16 2 2 bmi d:16 2 2 bge d:16 2 2 blt d:16 2 2 bgt d:16 2 2 ble d:16 2 2 bclr bclr #xx:3, rd 1 bclr #xx:3, @erd 2 2 bclr #xx:3, @aa:8 2 2 bclr rn, rd 1 bclr rn, @erd 2 2 bclr rn, @aa:8 2 2 biand biand #xx:3, rd 1 biand #xx:3, @erd 2 1 biand #xx:3, @aa:8 2 1 bild bild #xx:3, rd 1 bild #xx:3, @erd 2 1 bild #xx:3, @aa:8 2 1
appendix a instruction set rev. 3.00 sep 27, 2006 page 727 of 872 rej09b0325-0300 instruction mnemonic instruction fetch i branch addr. read j stack operation k byte data access l word data access m internal operation n bior bior #xx:8, rd 1 bior #xx:8, @erd 2 1 bior #xx:8, @aa:8 2 1 bist bist #xx:3, rd 1 bist #xx:3, @erd 2 2 bist #xx:3, @aa:8 2 2 bixor bixor #xx:3, rd 1 bixor #xx:3, @erd 2 1 bixor #xx:3, @aa:8 2 1 bld bld #xx:3, rd 1 bld #xx:3, @erd 2 1 bld #xx:3, @aa:8 2 1 bnot bnot #xx:3, rd 1 bnot #xx:3, @erd 2 2 bnot #xx:3, @aa:8 2 2 bnot rn, rd 1 bnot rn, @erd 2 2 bnot rn, @aa:8 2 2 bor bor #xx:3, rd 1 bor #xx:3, @erd 2 1 bor #xx:3, @aa:8 2 1 bset bset #xx:3, rd 1 bset #xx:3, @erd 2 2 bset #xx:3, @aa:8 2 2 bset rn, rd 1 bset rn, @erd 2 2 bset rn, @aa:8 2 2 bsr bsr d:8 normal * 1 21 advanced 2 2 bsr d:16 normal * 1 21 2 advanced 2 2 2
appendix a instruction set rev. 3.00 sep 27, 2006 page 728 of 872 rej09b0325-0300 instruction mnemonic instruction fetch i branch addr. read j stack operation k byte data access l word data access m internal operation n bst bst #xx:3, rd 1 bst #xx:3, @erd 2 2 bst #xx:3, @aa:8 2 2 btst btst #xx:3, rd 1 btst #xx:3, @erd 2 1 btst #xx:3, @aa:8 2 1 btst rn, rd 1 btst rn, @erd 2 1 btst rn, @aa:8 2 1 bxor bxor #xx:3, rd 1 bxor #xx:3, @erd 2 1 bxor #xx:3, @aa:8 2 1 cmp cmp.b #xx:8, rd 1 cmp.b rs, rd 1 cmp.w #xx:16, rd 2 cmp.w rs, rd 1 cmp.l #xx:32, erd 3 cmp.l ers, erd 1 daa daa rd 1 das das rd 1 dec dec.b rd 1 dec.w #1/2, rd 1 dec.l #1/2, erd 1 divxs divxs.b rs, rd 2 12 divxs.w rs, erd 2 20 divxu divxu.b rs, rd 1 12 divxu.w rs, erd 1 20 eepmov eepmov.b 2 2n + 2 * 2 eepmov.w 2 2n + 2 * 2 exts exts.w rd 1 exts.l erd 1 extu extu.w rd 1 extu.l erd 1
appendix a instruction set rev. 3.00 sep 27, 2006 page 729 of 872 rej09b0325-0300 instruction mnemonic instruction fetch i branch addr. read j stack operation k byte data access l word data access m internal operation n inc inc.b rd 1 inc.w #1/2, rd 1 inc.l #1/2, erd 1 jmp jmp @ern 2 jmp @aa:24 2 2 jmp @@aa:8 normal * 1 21 2 advanced 2 2 2 jsr jsr @ern normal * 1 21 advanced 2 2 jsr @aa:24 normal * 1 21 2 advanced 2 2 2 jsr @@aa:8 normal * 1 211 advanced 2 2 2 ldc ldc #xx:8, ccr 1 ldc rs, ccr 1 ldc @ers, ccr 2 1 ldc @(d:16, ers), ccr 3 1 ldc @(d:24, ers), ccr 5 1 ldc @ers+, ccr 2 1 2 ldc @aa:16, ccr 3 1 ldc @aa:24, ccr 4 1 mov mov.b #xx:8, rd 1 mov.b rs, rd 1 mov.b @ers, rd 1 1 mov.b @(d:16, ers), rd 2 1 mov.b @(d:24, ers), rd 4 1 mov.b @ers+, rd 1 1 2 mov.b @aa:8, rd 1 1 mov.b @aa:16, rd 2 1 mov.b @aa:24, rd 3 1 mov.b rs, @erd 1 1 mov.b rs, @(d:16, erd) 2 1
appendix a instruction set rev. 3.00 sep 27, 2006 page 730 of 872 rej09b0325-0300 instruction mnemonic instruction fetch i branch addr. read j stack operation k byte data access l word data access m internal operation n mov mov.b rs, @(d:24, erd) 4 1 mov.b rs, @ ? erd 1 1 2 mov.b rs, @aa:8 1 1 mov.b rs, @aa:16 2 1 mov.b rs, @aa:24 3 1 mov.w #xx:16, rd 2 mov.w rs, rd 1 mov.w @ers, rd 1 1 mov.w @(d:16, ers), rd 2 1 mov.w @(d:24, ers), rd 4 1 mov.w @ers+, rd 1 1 2 mov.w @aa:16, rd 2 1 mov.w @aa:24, rd 3 1 mov.w rs, @erd 1 1 mov.w rs, @(d:16, erd) 2 1 mov.w rs, @(d:24, erd) 4 1 mov.w rs, @ ? erd 1 1 2 mov.w rs, @aa:16 2 1 mov.w rs, @aa:24 3 1 mov.l #xx:32, erd 3 mov.l ers, erd 1 mov.l @ers, erd 2 2 mov.l @(d:16, ers), erd 3 2 mov.l @(d:24, ers), erd 5 2 mov.l @ers+, erd 2 2 2 mov.l @aa:16, erd 3 2 mov.l @aa:24, erd 4 2 mov.l ers, @erd 2 2 mov.l ers, @(d:16, erd) 3 2 mov.l ers, @(d:24, erd) 5 2 mov.l ers, @ ? erd 2 2 2 mov.l ers, @aa:16 3 2 mov.l ers, @aa:24 4 2
appendix a instruction set rev. 3.00 sep 27, 2006 page 731 of 872 rej09b0325-0300 instruction mnemonic instruction fetch i branch addr. read j stack operation k byte data access l word data access m internal operation n movfpe movfpe @aa:16, rd * 1 21 movtpe movtpe rs, @aa:16 * 1 21 mulxs mulxs.b rs, rd 2 12 mulxs.w rs, erd 2 20 mulxu mulxu.b rs, rd 1 12 mulxu.w rs, erd 1 20 neg neg.b rd 1 neg.w rd 1 neg.l erd 1 nop nop 1 not not.b rd 1 not.w rd 1 not.l erd 1 or or.b #xx:8, rd 1 or.b rs, rd 1 or.w #xx:16, rd 2 or.w rs, rd 1 or.l #xx:32, erd 3 or.l ers, erd 2 orc orc #xx:8, ccr 1 pop pop.w rn 1 1 2 pop.l ern 2 2 2 push push.w rn 1 1 2 push.l ern 2 2 2 rotl rotl.b rd 1 rotl.w rd 1 rotl.l erd 1 rotr rotr.b rd 1 rotr.w rd 1 rotr.l erd 1 rotxl rotxl.b rd 1 rotxl.w rd 1 rotxl.l erd 1
appendix a instruction set rev. 3.00 sep 27, 2006 page 732 of 872 rej09b0325-0300 instruction mnemonic instruction fetch i branch addr. read j stack operation k byte data access l word data access m internal operation n rotxr rotxr.b rd 1 rotxr.w rd 1 rotxr.l erd 1 rte rte 2 2 2 rts rts normal * 1 21 2 advanced 2 2 2 shal shal.b rd 1 shal.w rd 1 shal.l erd 1 shar shar.b rd 1 shar.w rd 1 shar.l erd 1 shll shll.b rd 1 shll.w rd 1 shll.l erd 1 shlr shlr.b rd 1 shlr.w rd 1 shlr.l erd 1 sleep sleep 1 stc stc ccr, rd 1 stc ccr, @erd 2 1 stc ccr, @(d:16, erd) 3 1 stc ccr, @(d:24, erd) 5 1 stc ccr, @ ? erd 2 1 2 stc ccr, @aa:16 3 1 stc ccr, @aa:24 4 1 sub sub.b rs, rd 1 sub.w #xx:16, rd 2 sub.w rs, rd 1 sub.l #xx:32, erd 3 sub.l ers, erd 1 subs subs #1/2/4, erd 1
appendix a instruction set rev. 3.00 sep 27, 2006 page 733 of 872 rej09b0325-0300 instruction mnemonic instruction fetch i branch addr. read j stack operation k byte data access l word data access m internal operation n subx subx #xx:8, rd 1 subx rs, rd 1 trapa trapa #x:2 normal * 1 212 4 advanced 2 2 2 4 xor xor.b #xx:8, rd 1 xor.b rs, rd 1 xor.w #xx:16, rd 2 xor.w rs, rd 1 xor.l #xx:32, erd 3 xor.l ers, erd 2 xorc xorc #xx:8, ccr 1 notes: 1. not available in the h8/3048b group. 2. n is the value set in register r4l or r4. the source and destination are accessed n + 1 times each.
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 734 of 872 rej09b0325-0300 appendix b internal i/o register table b.1 comparison of h8/3048 group and h8/3048b group internal i/o register specifications address (low) h8/3048 ztat h8/3048 mask rom version, h8/3047 mask rom version, h8/3045 mask rom version, h8/3044 mask rom version h8/3048f h8/3048 f-one h8/3048b mask rom version module h'ff40 ? ? flmcr flmcr1 ? h'ff41 ? ? ? flmcr2 ? h'ff42 ? ? ebr1 ebr ? h'ff43 ? ? ebr2 ? ? h'ff47 ? ? ? ramcr ? h'ff48 ? ? ramcr ? ? flash memory note: a dash (???) indicates that access is prohibited. normal operation is not guaranteed if these addresses are accessed.
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 735 of 872 rej09b0325-0300 b.1 addresses (for h8/3048f-one, h8/3048b mask rom version) bit names address (low) register name data bus width bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module name h'1c h'1d h'1e h'1f reserved area (access prohibited) h'20 mar0ar 8 h'21 mar0ae 8 dmac channel 0a h'22 mar0ah 8 h'23 mar0al 8 h'24 etcr0ah 8 h'25 etcr0al 8 h'26 ioar0a 8 h'27 dtcr0a 8 dte dtsz dtid rpe dtie dts2 dts1 dts0 short address mode dte dtsz said saide dtie dts2a dts1a dts0a full address mode h'28 mar0br 8 dmac channel 0b h'29 mar0be 8 h'2a mar0bh 8 h'2b mar0bl 8 h'2c etcr0bh 8 h'2d etcr0bl 8 h'2e ioar0b 8 h'2f dtcr0b 8 dte dtsz dtid rpe dtie dts2 dts1 dts0 short address mode dtme ? daid daide tms dts2b dts1b dts0b full address mode
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 736 of 872 rej09b0325-0300 bit names address (low) register name data bus width bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module name h'30 mar1ar 8 h'31 mar1ae 8 dmac channel 1a h'32 mar1ah 8 h'33 mar1al 8 h'34 etcr1ah 8 h'35 etcr1al 8 h'36 ioar1a 8 h'37 dtcr1a 8 dte dtsz dtid rpe dtie dts2 dts1 dts0 short address mode dte dtsz said saide dtie dts2a dts1a dts0a full address mode h'38 mar1br 8 h'39 mar1be 8 dmac channel 1b h'3a mar1bh 8 h'3b mar1bl 8 h'3c etcr1bh 8 h'3d etcr1bl 8 h'3e ioar1b 8 h'3f dtcr1b 8 dte dtsz dtid rpe dtie dts2 dts1 dts0 short address mode dtme ? daid daide tms dts2b dts1b dts0b full address mode h'40 flmcr1 * 4 8 fwe swe esu psu ev pv e p h'41 flmcr2 * 4 8fler? * 3 ? * 3 ? * 3 ? * 3 ? * 3 ? * 3 ? * 3 flash memory h'42 ebr * 4 8 eb7 eb6 eb5 eb4 eb3 eb2 eb1 eb0 h'43 h'44 h'45 h'46 reserved area (access prohibited) h'47 ramcr * 4 8 ? ? ? ? rams ram2 ram1 ? h'48 h'49 h'4a h'4b h'4c h'4d h'4e h'4f reserved area (access prohibited)
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 737 of 872 rej09b0325-0300 bit names address (low) register name data bus width bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module name h'50 h'51 h'52 h'53 h'54 h'55 h'56 h'57 h'58 h'59 h'5a h'5b reserved area (access prohibited) h'5c dastcr 8 ? ? ? ? ? ? ? daste d/a converter h'5d divcr 8 ? ? ? ? ? ? div1 div0 h'5e mstcr 8 pstop ? mstop5 mstop4 mstop3 mstop2 mstop1 mstop0 system control h'5f cscr 8 cs7e cs6e cs5e cs4e ? ? ? ? bus controller h'60 tstr 8 ? ? ? str4 str3 str2 str1 str0 h'61 tsnc 8 ? ? ? sync4 sync3 sync2 sync1 sync0 h'62 tmdr 8 ? mdf fdir pwm4 pwm3 pwm2 pwm1 pwm0 h'63 tfcr 8 ? ? cmd1 cmd0 bfb4 bfa4 bfb3 bfa3 itu (all channels) h'64 tcr0 8 ? cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 h'65 tior0 8 ? iob2 iob1 iob0 ? ioa2 ioa1 ioa0 h'66 tier0 8 ? ? ? ? ? ovie imieb imiea h'67 tsr0 8 ? ? ? ? ? ovf imfb imfa h'68 tcnt0h 16 h'69 tcnt0l h'6a gra0h 16 h'6b gra0l h'6c grb0h 16 h'6d grb0l itu channel 0 h'6e tcr1 8 ? cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 h'6f tior1 8 ? iob2 iob1 iob0 ? ioa2 ioa1 ioa0 itu channel 1
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 738 of 872 rej09b0325-0300 bit names address (low) register name data bus width bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module name h'70 tier1 8 ? ? ? ? ? ovie imieb imiea itu channel 1 h'71 tsr1 8 ? ? ? ? ? ovf imfb imfa h'72 tcnt1h 16 h'73 tcnt1l h'74 gra1h 16 h'75 gra1l h'76 grb1h 16 h'77 grb1l h'78 tcr2 8 ? cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 itu channel 2 h'79 tior2 8 ? iob2 iob1 iob0 ? ioa2 ioa1 ioa0 h'7a tier2 8 ? ? ? ? ? ovie imieb imiea h'7b tsr2 8 ? ? ? ? ? ovf imfb imfa h'7c tcnt2h 16 h'7d tcnt2l h'7e gra2h 16 h'7f gra2l h'80 grb2h 16 h'81 grb2l h'82 tcr3 8 ? cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 itu channel 3 h'83 tior3 8 ? iob2 iob1 iob0 ? ioa2 ioa1 ioa0 h'84 tier3 8 ? ? ? ? ? ovie imieb imiea h'85 tsr3 8 ? ? ? ? ? ovf imfb imfa h'86 tcnt3h 16 h'87 tcnt3l h'88 gra3h 16 h'89 gra3l h'8a grb3h 16 h'8b grb3l h'8c bra3h 16 h'8d bra3l h'8e brb3h 16 h'8f brb3l
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 739 of 872 rej09b0325-0300 bit names address (low) register name data bus width bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module name h'90 toer 8 ? ? exb4 exa4 eb3 eb4 ea4 ea3 h'91 tocr 8 ? ? ? xtgd ? ? ols4 ols3 itu (all channels) h'92 tcr4 8 ? cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 itu channel 4 h'93 tior4 8 ? iob2 iob1 iob0 ? ioa2 ioa1 ioa0 h'94 tier4 8 ? ? ? ? ? ovie imieb imiea h'95 tsr4 8 ? ? ? ? ? ovf imfb imfa h'96 tcnt4h 16 h'97 tcnt4l h'98 gra4h 16 h'99 gra4l h'9a grb4h 16 h'9b grb4l h'9c bra4h 16 h'9d bra4l h'9e brb4h 16 h'9f brb4l h'a0 tpmr 8 ? ? ? ? g3nov g2nov g1nov g0nov tpc h'a1 tpcr 8 g3cms1 g3cms0 g2cms1 g2cms0 g1cms1 g1cms0 g0cms1 g0cms0 h'a2 nderb 8 nder15 nder14 nder13 nder12 nder11 nder10 nder9 nder8 h'a3 ndera 8 nder7 nder6 nder5 nder4 nder3 nder2 nder1 nder0 h'a4 ndrb * 1 8 ndr15 ndr14 ndr13 ndr12 ndr11 ndr10 ndr9 ndr8 8 ndr15 ndr14 ndr13 ndr12 ? ? ? ? h'a5 ndra * 1 8 ndr7 ndr6 ndr5 ndr4 ndr3 ndr2 ndr1 ndr0 8 ndr7 ndr6 ndr5 ndr4 ? ? ? ? h'a6 ndrb * 1 8? ? ? ? ? ? ? ? 8 ? ? ? ? ndr11 ndr10 ndr9 ndr8 h'a7 ndra * 1 8? ? ? ? ? ? ? ? 8 ? ? ? ? ndr3 ndr2 ndr1 ndr0 h'a8 tcsr * 2 8ovfwt/ it tme ? ? cks2 cks1 cks0 wdt h'a9 tcnt * 2 8 h'aa ? ? ? ? ? ? ? ? ? h'ab rstcsr * 2 8wrst? ? ? ? ? ? ? h'ac rfshcr 8 srfmd psrame drame cas/ we m9/ m8 rfshe ? rcyce h'ad rtmcsr 8 cmf cmie cks2 cks1 cks0 ? ? ? h'ae rtcnt 8 h'af rtcor 8 refresh controller
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 740 of 872 rej09b0325-0300 bit names address (low) register name data bus width bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module name h'b0 smr 8 c/ a / gm chr pe o/ e stop mp cks1 cks0 sci channel 0 h'b1 brr 8 h'b2 scr 8 tie rie te re mpie teie cke1 cke0 h'b3 tdr 8 h'b4 ssr 8 tdre rdrf orer fer/ ers per tend mpb mpbt h'b5 rdr 8 h'b6 scmr 8 ? ? ? ? sdir sinv ? smif h'b7 reserved area (access prohibited) h'b8 smr 8 c/ a chr pe o/ e stop mp cks1 cks0 sci channel 1 h'b9 brr 8 h'ba scr 8 tie rie te re mpie teie cke1 cke0 h'bb tdr 8 h'bc ssr 8 tdre rdrf orer fer per tend mpb mpbt h'bd rdr 8 h'be h'bf reserved area (access prohibited) h'c0 p1ddr 8 p1 7 ddr p1 6 ddr p1 5 ddr p1 4 ddr p1 3 ddr p1 2 ddr p1 1 ddr p1 0 ddr port 1 h'c1 p2ddr 8 p2 7 ddr p2 6 ddr p2 5 ddr p2 4 ddr p2 3 ddr p2 2 ddr p2 1 ddr p2 0 ddr port 2 h'c2 p1dr 8 p1 7 p1 6 p1 5 p1 4 p1 3 p1 2 p1 1 p1 0 port 1 h'c3 p2dr 8 p2 7 p2 6 p2 5 p2 4 p2 3 p2 2 p2 1 p2 0 port 2 h'c4 p3ddr 8 p3 7 ddr p3 6 ddr p3 5 ddr p3 4 ddr p3 3 ddr p3 2 ddr p3 1 ddr p3 0 ddr port 3 h'c5 p4ddr 8 p4 7 ddr p4 6 ddr p4 5 ddr p4 4 ddr p4 3 ddr p4 2 ddr p4 1 ddr p4 0 ddr port 4 h'c6 p3dr 8 p3 7 p3 6 p3 5 p3 4 p3 3 p3 2 p3 1 p3 0 port 3 h'c7 p4dr 8 p4 7 p4 6 p4 5 p4 4 p4 3 p4 2 p4 1 p4 0 port 4 h'c8 p5ddr 8 ? ? ? ? p5 3 ddr p5 2 ddr p5 1 ddr p5 0 ddr port 5 h'c9 p6ddr 8 ? p6 6 ddr p6 5 ddr p6 4 ddr p6 3 ddr p6 2 ddr p6 1 ddr p6 0 ddr port 6 h'ca p5dr 8 ? ? ? ? p5 3 p5 2 p5 1 p5 0 port 5 h'cb p6dr 8 ? p6 6 p6 5 p6 4 p6 3 p6 2 p6 1 p6 0 port 6 h'cc ? ? ? ? ? ? ? ? ? h'cd p8ddr 8 ? ? ? p8 4 ddr p8 3 ddr p8 2 ddr p8 1 ddr p8 0 ddr port 8 h'ce p7dr 8 p7 7 p7 6 p7 5 p7 4 p7 3 p7 2 p7 1 p7 0 port 7 h'cf p8dr 8 ? ? ? p8 4 p8 3 p8 2 p8 1 p8 0 port 8
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 741 of 872 rej09b0325-0300 bit names address (low) register name data bus width bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module name h'd0 p9ddr 8 ? ? p9 5 ddr p9 4 ddr p9 3 ddr p9 2 ddr p9 1 ddr p9 0 ddr port 9 h'd1 paddr 8 pa 7 ddr pa 6 ddr pa 5 ddr pa 4 ddr pa 3 ddr pa 2 ddr pa 1 ddr pa 0 ddr port a h'd2 p9dr 8 ? ? p9 5 p9 4 p9 3 p9 2 p9 1 p9 0 port 9 h'd3 padr 8 pa 7 pa 6 pa 5 pa 4 pa 3 pa 2 pa 1 pa 0 port a h'd4 pbddr 8 pb 7 ddr pb 6 ddr pb 5 ddr pb 4 ddr pb 3 ddr pb 2 ddr pb 1 ddr pb 0 ddr port b h'd5 ? ? ? ? ? ? ? ? ? ? ? h'd6 pbdr 8 pb 7 pb 6 pb 5 pb 4 pb 3 pb 2 pb 1 pb 0 port b h'd7 ? ? ? ? ? ? ? ? ? ? ? h'd8 p2pcr 8 p2 7 pcr p2 6 pcr p2 5 pcr p2 4 pcr p2 3 pcr p2 2 pcr p2 1 pcr p2 0 pcr port 2 h'd9 ? ? ? ? ? ? ? ? ? h'da p4pcr 8 p4 7 pcr p4 6 pcr p4 5 pcr p4 4 pcr p4 3 pcr p4 2 pcr p4 1 pcr p4 0 pcr port 4 h'db p5pcr 8 ? ? ? ? p5 3 pcr p5 2 pcr p5 1 pcr p5 0 pcr port 5 h'dc dadr0 8 d/a converter h'dd dadr1 8 h'de dacr 8 daoe1 daoe0 dae ? ? ? ? ? h'df reserved area (access prohibited) h'e0 addrah 8 ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 a/d converter h'e1 addral 8 ad1 ad0 ? ? ? ? ? ? h'e2 addrbh 8 ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 h'e3 addrbl 8 ad1 ad0 ? ? ? ? ? ? h'e4 addrch 8 ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 h'e5 addrcl 8 ad1 ad0 ? ? ? ? ? ? h'e6 addrdh 8 ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 h'e7 addrdl 8 ad1 ad0 ? ? ? ? ? ? h'e8 adcsr 8 adf adie adst scan cks ch2 ch1 ch0 h'e9 adcr 8 trge ? ? ? ? ? ? ? h'ea h'eb reserved area (access prohibited) h'ec abwcr 8 abw7 abw6 abw5 abw4 abw3 abw2 abw1 abw0 bus controller h'ed astcr 8 ast7 ast6 ast5 ast4 ast3 ast2 ast1 ast0 h'ee wcr 8 ? ? ? ? wms1 wms0 wc1 wc0 h'ef wcer 8 wce7 wce6 wce5 wce4 wce3 wce2 wce1 wce0
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 742 of 872 rej09b0325-0300 bit names address (low) register name data bus width bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module name h'f0 reserved area (access prohibited) h'f1 mdcr 8 ? ? ? ? ? mds2 mds1 mds0 h'f2 syscr 8 ssby sts2 sts1 sts0 ue nmieg ? rame system control h'f3 brcr 8 a23e a22e a21e ? ? ? ? brle bus controller h'f4 iscr 8 ? ? irq5sc irq4sc irq3sc irq2sc irq1sc irq0sc h'f5 ier 8 ? ? irq5e irq4e irq3e irq2e irq1e irq0e h'f6 isr 8 ? ? irq5f irq4f irq3f irq2f irq1f irq0f h'f7 reserved area (access prohibited) h'f8 ipra 8 ipra7 ipra6 ipra5 ipra4 ipra3 ipra2 ipra1 ipra0 h'f9 iprb 8 iprb7 iprb6 iprb5 ? iprb3 iprb2 iprb1 ? interrupt controller h'fa h'fb h'fc h'fd h'fe h'ff reserved area (access prohibited) legend: dmac: dma controller itu: 16-bit integrated timer unit tpc: programmable timing pattern controller wdt: watchdog timer sci: serial communication interface notes: 1. the address depends on the output trigger setting. 2. for write access to tcsr tcnt, and rstcr see section 12.2.4, notes on register rewriting. 3. bits 6 to 0 in flmcr2 are reserved bits but are readable/writable. 4. byte data must be used to access flmcr1, flmcr2, ebr, and ramcr. registers flmcr1, flmcr2, ebr, and ramcr are implemented in the flash memory version only. the mask rom version does not have these registers.
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 743 of 872 rej09b0325-0300 b.2 addresses (for h8/3048f, h8/3048ztat, h8/3048 mask-rom, h8/3047 mask-rom, h8/3045 mask-rom, and h8/3044 mask- rom versions) bit names address (low) register name data bus width bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module name h'1c h'1d h'1e h'1f h'20 mar0ar 8 h'21 mar0ae 8 dmac channel 0a h'22 mar0ah 8 h'23 mar0al 8 h'24 etcr0ah 8 h'25 etcr0al 8 h'26 ioar0a 8 h'27 dtcr0a 8 dte dtsz dtid rpe dtie dts2 dts1 dts0 short address mode dte dtsz said saide dtie dts2a dts1a dts0a full address mode h'28 mar0br 8 dmac channel 0b h'29 mar0be 8 h'2a mar0bh 8 h'2b mar0bl 8 h'2c etcr0bh 8 h'2d etcr0bl 8 h'2e ioar0b 8 h'2f dtcr0b 8 dte dtsz dtid rpe dtie dts2 dts1 dts0 short address mode dtme ? daid daide tms dts2b dts1b dts0b full address mode
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 744 of 872 rej09b0325-0300 bit names address (low) register name data bus width bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module name h'30 mar1ar 8 h'31 mar1ae 8 dmac channel 1a h'32 mar1ah 8 h'33 mar1al 8 h'34 etcr1ah 8 h'35 etcr1al 8 h'36 ioar1a 8 h'37 dtcr1a 8 dte dtsz dtid rpe dtie dts2 dts1 dts0 short address mode dte dtsz said saide dtie dts2a dts1a dts0a full address mode h'38 mar1br 8 h'39 mar1be 8 dmac channel 1b h'3a mar1bh 8 h'3b mar1bl 8 h'3c etcr1bh 8 h'3d etcr1bl 8 h'3e ioar1b 8 h'3f dtcr1b 8 dte dtsz dtid rpe dtie dts2 dts1 dts0 short address mode dtme ? daid daide tms dts2b dts1b dts0b full address mode h'40 flmcr 8 v pp v pp e? ? evpve p h'41 ? ? ? ? ? ? ? ? ? flash memory h'42 ebr1 8 lb7 lb6 lb5 lb4 lb3 lb2 lb1 lb0 h'43 ebr2 8 sb7 sb6 sb5 sb4 sb3 sb2 sb1 sb0 h'44 ? ? ? ? ? ? ? ? ? h'45 ? ? ? ? ? ? ? ? ? h'46 ? ? ? ? ? ? ? ? ? h'47 ? ? ? ? ? ? ? ? ? h'48 ramcr 8 fler ? ? ? rams ram2 ram1 ram0 h'49 ? ? ? ? ? ? ? ? ? h'4a ? ? ? ? ? ? ? ? ? h'4b ? ? ? ? ? ? ? ? ? h'4c ? ? ? ? ? ? ? ? ? h'4d ? ? ? ? ? ? ? ? ? h'4e ? ? ? ? ? ? ? ? ? h'4f ? ? ? ? ? ? ? ? ?
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 745 of 872 rej09b0325-0300 bit names address (low) register name data bus width bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module name h'50 ? ? ? ? ? ? ? ? ? h'51 ? ? ? ? ? ? ? ? ? h'52 ? ? ? ? ? ? ? ? ? h'53 ? ? ? ? ? ? ? ? ? h'54 ? ? ? ? ? ? ? ? ? h'55 ? ? ? ? ? ? ? ? ? h'56 ? ? ? ? ? ? ? ? ? h'57 ? ? ? ? ? ? ? ? ? h'58 ? ? ? ? ? ? ? ? ? h'59 ? ? ? ? ? ? ? ? ? h'5a ? ? ? ? ? ? ? ? ? h'5b ? ? ? ? ? ? ? ? ? h'5c dastcr 8 ? ? ? ? ? ? ? daste d/a converter h'5d divcr 8 ? ? ? ? ? ? div1 div0 h'5e mstcr 8 pstop ? mstop5 mstop4 mstop3 mstop2 mstop1 mstop0 system control h'5f cscr 8 cs7e cs6e cs5e cs4e ? ? ? ? bus controller h'60 tstr 8 ? ? ? str4 str3 str2 str1 str0 h'61 tsnc 8 ? ? ? sync4 sync3 sync2 sync1 sync0 h'62 tmdr 8 ? mdf fdir pwm4 pwm3 pwm2 pwm1 pwm0 h'63 tfcr 8 ? ? cmd1 cmd0 bfb4 bfa4 bfb3 bfa3 itu (all channels) h'64 tcr0 8 ? cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 h'65 tior0 8 ? iob2 iob1 iob0 ? ioa2 ioa1 ioa0 h'66 tier0 8 ? ? ? ? ? ovie imieb imiea h'67 tsr0 8 ? ? ? ? ? ovf imfb imfa h'68 tcnt0h 16 h'69 tcnt0l h'6a gra0h 16 h'6b gra0l h'6c grb0h 16 h'6d grb0l itu channel 0 h'6e tcr1 8 ? cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 h'6f tior1 8 ? iob2 iob1 iob0 ? ioa2 ioa1 ioa0 itu channel 1
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 746 of 872 rej09b0325-0300 bit names address (low) register name data bus width bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module name h'70 tier1 8 ? ? ? ? ? ovie imieb imiea itu channel 1 h'71 tsr1 8 ? ? ? ? ? ovf imfb imfa h'72 tcnt1h 16 h'73 tcnt1l h'74 gra1h 16 h'75 gra1l h'76 grb1h 16 h'77 grb1l h'78 tcr2 8 ? cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 itu channel 2 h'79 tior2 8 ? iob2 iob1 iob0 ? ioa2 ioa1 ioa0 h'7a tier2 8 ? ? ? ? ? ovie imieb imiea h'7b tsr2 8 ? ? ? ? ? ovf imfb imfa h'7c tcnt2h 16 h'7d tcnt2l h'7e gra2h 16 h'7f gra2l h'80 grb2h 16 h'81 grb2l h'82 tcr3 8 ? cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 itu channel 3 h'83 tior3 8 ? iob2 iob1 iob0 ? ioa2 ioa1 ioa0 h'84 tier3 8 ? ? ? ? ? ovie imieb imiea h'85 tsr3 8 ? ? ? ? ? ovf imfb imfa h'86 tcnt3h 16 h'87 tcnt3l h'88 gra3h 16 h'89 gra3l h'8a grb3h 16 h'8b grb3l h'8c bra3h 16 h'8d bra3l h'8e brb3h 16 h'8f brb3l
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 747 of 872 rej09b0325-0300 bit names address (low) register name data bus width bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module name h'90 toer 8 ? ? exb4 exa4 eb3 eb4 ea4 ea3 h'91 tocr 8 ? ? ? xtgd ? ? ols4 ols3 itu (all channels) h'92 tcr4 8 ? cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 itu channel 4 h'93 tior4 8 ? iob2 iob1 iob0 ? ioa2 ioa1 ioa0 h'94 tier4 8 ? ? ? ? ? ovie imieb imiea h'95 tsr4 8 ? ? ? ? ? ovf imfb imfa h'96 tcnt4h 16 h'97 tcnt4l h'98 gra4h 16 h'99 gra4l h'9a grb4h 16 h'9b grb4l h'9c bra4h 16 h'9d bra4l h'9e brb4h 16 h'9f brb4l h'a0 tpmr 8 ? ? ? ? g3nov g2nov g1nov g0nov tpc h'a1 tpcr 8 g3cms1 g3cms0 g2cms1 g2cms0 g1cms1 g1cms0 g0cms1 g0cms0 h'a2 nderb 8 nder15 nder14 nder13 nder12 nder11 nder10 nder9 nder8 h'a3 ndera 8 nder7 nder6 nder5 nder4 nder3 nder2 nder1 nder0 h'a4 ndrb * 1 8 ndr15 ndr14 ndr13 ndr12 ndr11 ndr10 ndr9 ndr8 8 ndr15 ndr14 ndr13 ndr12 ? ? ? ? h'a5 ndra * 1 8 ndr7 ndr6 ndr5 ndr4 ndr3 ndr2 ndr1 ndr0 8 ndr7 ndr6 ndr5 ndr4 ? ? ? ? h'a6 ndrb * 1 8? ? ? ? ? ? ? ? 8 ? ? ? ? ndr11 ndr10 ndr9 ndr8 h'a7 ndra * 1 8? ? ? ? ? ? ? ? 8 ? ? ? ? ndr3 ndr2 ndr1 ndr0 h'a8 tcsr * 2 8ovfwt/ it tme ? ? cks2 cks1 cks0 wdt h'a9 tcnt * 2 8 h'aa ? ? ? ? ? ? ? ? ? h'ab rstcsr * 2 8wrstrstoe? ? ? ? ? ? h'ac rfshcr 8 srfmd psrame drame cas/ we m9/ m8 rfshe ? rcyce h'ad rtmcsr 8 cmf cmie cks2 cks1 cks0 ? ? ? h'ae rtcnt 8 h'af rtcor 8 refresh controller
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 748 of 872 rej09b0325-0300 bit names address (low) register name data bus width bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module name h'b0 smr 8 c/ a / gm chr pe o/ e stop mp cks1 cks0 sci channel 0 h'b1 brr 8 h'b2 scr 8 tie rie te re mpie teie cke1 cke0 h'b3 tdr 8 h'b4 ssr 8 tdre rdrf orer fer/ ers per tend mpb mpbt h'b5 rdr 8 h'b6 scmr 8 ? ? ? ? sdir sinv ? smif h'b7 h'b8 smr 8 c/ a chr pe o/ e stop mp cks1 cks0 sci channel 1 h'b9 brr 8 h'ba scr 8 tie rie te re mpie teie cke1 cke0 h'bb tdr 8 h'bc ssr 8 tdre rdrf orer fer per tend mpb mpbt h'bd rdr 8 h'be ? ? ? ? ? ? ? ? ? h'bf h'c0 p1ddr 8 p1 7 ddr p1 6 ddr p1 5 ddr p1 4 ddr p1 3 ddr p1 2 ddr p1 1 ddr p1 0 ddr port 1 h'c1 p2ddr 8 p2 7 ddr p2 6 ddr p2 5 ddr p2 4 ddr p2 3 ddr p2 2 ddr p2 1 ddr p2 0 ddr port 2 h'c2 p1dr 8 p1 7 p1 6 p1 5 p1 4 p1 3 p1 2 p1 1 p1 0 port 1 h'c3 p2dr 8 p2 7 p2 6 p2 5 p2 4 p2 3 p2 2 p2 1 p2 0 port 2 h'c4 p3ddr 8 p3 7 ddr p3 6 ddr p3 5 ddr p3 4 ddr p3 3 ddr p3 2 ddr p3 1 ddr p3 0 ddr port 3 h'c5 p4ddr 8 p4 7 ddr p4 6 ddr p4 5 ddr p4 4 ddr p4 3 ddr p4 2 ddr p4 1 ddr p4 0 ddr port 4 h'c6 p3dr 8 p3 7 p3 6 p3 5 p3 4 p3 3 p3 2 p3 1 p3 0 port 3 h'c7 p4dr 8 p4 7 p4 6 p4 5 p4 4 p4 3 p4 2 p4 1 p4 0 port 4 h'c8 p5ddr 8 ? ? ? ? p5 3 ddr p5 2 ddr p5 1 ddr p5 0 ddr port 5 h'c9 p6ddr 8 ? p6 6 ddr p6 5 ddr p6 4 ddr p6 3 ddr p6 2 ddr p6 1 ddr p6 0 ddr port 6 h'ca p5dr 8 ? ? ? ? p5 3 p5 2 p5 1 p5 0 port 5 h'cb p6dr 8 ? p6 6 p6 5 p6 4 p6 3 p6 2 p6 1 p6 0 port 6 h'cc ? ? ? ? ? ? ? ? ? h'cd p8ddr 8 ? ? ? p8 4 ddr p8 3 ddr p8 2 ddr p8 1 ddr p8 0 ddr port 8 h'ce p7dr 8 p7 7 p7 6 p7 5 p7 4 p7 3 p7 2 p7 1 p7 0 port 7 h'cf p8dr 8 ? ? ? p8 4 p8 3 p8 2 p8 1 p8 0 port 8
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 749 of 872 rej09b0325-0300 bit names address (low) register name data bus width bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module name h'd0 p9ddr 8 ? ? p9 5 ddr p9 4 ddr p9 3 ddr p9 2 ddr p9 1 ddr p9 0 ddr port 9 h'd1 paddr 8 pa 7 ddr pa 6 ddr pa 5 ddr pa 4 ddr pa 3 ddr pa 2 ddr pa 1 ddr pa 0 ddr port a h'd2 p9dr 8 ? ? p9 5 p9 4 p9 3 p9 2 p9 1 p9 0 port 9 h'd3 padr 8 pa 7 pa 6 pa 5 pa 4 pa 3 pa 2 pa 1 pa 0 port a h'd4 pbddr 8 pb 7 ddr pb 6 ddr pb 5 ddr pb 4 ddr pb 3 ddr pb 2 ddr pb 1 ddr pb 0 ddr port b h'd5 ? ? ? ? ? ? ? ? ? h'd6 pbdr 8 pb 7 pb 6 pb 5 pb 4 pb 3 pb 2 pb 1 pb 0 port b h'd7 ? ? ? ? ? ? ? ? ? h'd8 p2pcr 8 p2 7 pcr p2 6 pcr p2 5 pcr p2 4 pcr p2 3 pcr p2 2 pcr p2 1 pcr p2 0 pcr port 2 h'd9 ? ? ? ? ? ? ? ? ? h'da p4pcr 8 p4 7 pcr p4 6 pcr p4 5 pcr p4 4 pcr p4 3 pcr p4 2 pcr p4 1 pcr p4 0 pcr port 4 h'db p5pcr 8 ? ? ? ? p5 3 pcr p5 2 pcr p5 1 pcr p5 0 pcr port 5 h'dc dadr0 8 d/a converter h'dd dadr1 8 h'de dacr 8 daoe1 daoe0 dae ? ? ? ? ? h'df ? ? ? ? ? ? ? ? ? h'e0 addrah 8 ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 a/d converter h'e1 addral 8 ad1 ad0 ? ? ? ? ? ? h'e2 addrbh 8 ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 h'e3 addrbl 8 ad1 ad0 ? ? ? ? ? ? h'e4 addrch 8 ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 h'e5 addrcl 8 ad1 ad0 ? ? ? ? ? ? h'e6 addrdh 8 ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 h'e7 addrdl 8 ad1 ad0 ? ? ? ? ? ? h'e8 adcsr 8 adf adie adst scan cks ch2 ch1 ch0 h'e9 adcr 8 trge ? ? ? ? ? ? ? h'ea ? ? ? ? ? ? ? ? ? h'eb ? ? ? ? ? ? ? ? ? h'ec abwcr 8 abw7 abw6 abw5 abw4 abw3 abw2 abw1 abw0 bus controller h'ed astcr 8 ast7 ast6 ast5 ast4 ast3 ast2 ast1 ast0 h'ee wcr 8 ? ? ? ? wms1 wms0 wc1 wc0 h'ef wcer 8 wce7 wce6 wce5 wce4 wce3 wce2 wce1 wce0
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 750 of 872 rej09b0325-0300 bit names address (low) register name data bus width bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module name h'f0 ? ? ? ? ? ? ? ? ? h'f1 mdcr 8 ? ? ? ? ? mds2 mds1 mds0 h'f2 syscr 8 ssby sts2 sts1 sts0 ue nmieg ? rame system control h'f3 brcr 8 a23e a22e a21e ? ? ? ? brle bus controller h'f4 iscr 8 ? ? irq5sc irq4sc irq3sc irq2sc irq1sc irq0sc h'f5 ier 8 ? ? irq5e irq4e irq3e irq2e irq1e irq0e h'f6 isr 8 ? ? irq5f irq4f irq3f irq2f irq1f irq0f h'f7 ? ? ? ? ? ? ? ? ? h'f8 ipra 8 ipra7 ipra6 ipra5 ipra4 ipra3 ipra2 ipra1 ipra0 h'f9 iprb 8 iprb7 iprb6 iprb5 ? iprb3 iprb2 iprb1 ? interrupt controller h'fa ? ? ? ? ? ? ? ? ? h'fb ? ? ? ? ? ? ? ? ? h'fc h'fd ? ? ? ? ? ? ? ? ? h'fe ? ? ? ? ? ? ? ? ? h'ff ? ? ? ? ? ? ? ? ? legend: dmac: dma controller itu: 16-bit integrated timer unit tpc: programmable timing pattern controller sci: serial communication interface wdt: watchdog timer notes: 1. the address depends on the output trigger setting. 2. for write access to tcsr, tcnt, and rstcsr, see section 12.2.4, notes on register rewriting.
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 751 of 872 rej09b0325-0300 b.3 function tstr timer start register h'60 itu (all channels) register name address to which the register is mapped name of on-chip supporting module register acronym bit numbers initial bit values names of the bits. dashes (?) indicate reserved bits. full name of bit descriptions of bit settings read only write only read and write r w r/w possible types of access bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 str4 0 r/w 3 str3 0 r/w 0 str0 0 r/w 2 str2 0 r/w 1 str1 0 r/w counter start 0 0 tcnt0 is halted 1 tcnt0 is counting counter start 3 0 tcnt3 is halted 1 tcnt3 is counting counter start 1 0 tcnt1 is halted 1 tcnt1 is counting counter start 2 0 tcnt2 is halted 1 tcnt2 is counting counter start 4 0 tcnt4 is halted 1 tcnt4 is counting
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 752 of 872 rej09b0325-0300 mar0a r/e/h/l?memory address register 0a r/e/h/l h'20, h'21, dmac0 h'22, h'23 bit initial value read/write 30 1 ? 28 1 ? 26 1 ? 24 1 ? 22 r/w 16 r/w 20 r/w 18 r/w 31 1 ? 29 1 ? 27 1 ? 25 1 ? 23 r/w 17 r/w 21 r/w 19 r/w mar0ar source or destination address mar0ae bit initial value read/write 14 r/w 12 r/w 10 r/w 8 r/w 6 r/w 0 r/w 4 r/w 2 r/w 15 r/w 13 r/w 11 r/w 9 r/w 7 r/w 1 r/w 5 r/w 3 r/w mar0ah mar0al undetermined undetermined undetermined
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 753 of 872 rej09b0325-0300 etcr0a h/l?execute transfer count register 0a h/l h'24, h'25 dmac0 ? short address mode ? i/o mode and idle mode bit initial value read/write 14 r/w 12 r/w 10 r/w 8 r/w 6 r/w 0 r/w 4 r/w 2 r/w transfer counter undetermined 15 r/w 13 r/w 11 r/w 9 r/w 7 r/w 1 r/w 5 r/w 3 r/w ? repeat mode bit initial value read/write 7 r/w 6 r/w 5 r/w 4 r/w 3 r/w 0 r/w 2 r/w 1 r/w undetermined transfer counter etcr0ah bit initial value read/write 7 r/w 6 r/w 5 r/w 4 r/w 3 r/w 0 r/w 2 r/w 1 r/w undetermined initial count etcr0al
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 754 of 872 rej09b0325-0300 etcr0a h/l?execute transfer count register 0a h/l h'24, h'25 dmac0 (cont) ? full address mode ? normal mode bit initial value read/write 14 r/w 12 r/w 10 r/w 8 r/w 6 r/w 0 r/w 4 r/w 2 r/w transfer counter undetermined 15 r/w 13 r/w 11 r/w 9 r/w 7 r/w 1 r/w 5 r/w 3 r/w ? block transfer mode bit initial value read/write 7 r/w 6 r/w 5 r/w 4 r/w 3 r/w 0 r/w 2 r/w 1 r/w undetermined block size counter etcr0ah bit initial value read/write 7 r/w 6 r/w 5 r/w 4 r/w 3 r/w 0 r/w 2 r/w 1 r/w undetermined initial block size etcr0al
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 755 of 872 rej09b0325-0300 ioar0a?i/o address register 0a h'26 dmac0 bit initial value read/write 7 r/w 6 r/w 5 r/w 4 r/w 3 r/w 0 r/w 2 r/w 1 r/w short address mode: full address mode: undetermined source or destination address not used
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 756 of 872 rej09b0325-0300 dtcr0a?data transfer control register 0a h'27 dmac0 ? short address mode bit initial value read/write 7 dte 0 r/w 6 dtsz 0 r/w 5 dtid 0 r/w 4 rpe 0 r/w 3 dtie 0 r/w 0 dts0 0 r/w 2 dts2 0 r/w 1 dts1 0 r/w data transfer enable 0 data transfer is disabled 1 data transfer is enabled data transfer size 0 byte-size transfer 1 word-size transfer data transfer increment/decrement 0 incremented: 1 decremented: data transfer select dts2 data transfer interrupt enable 0 interrupt requested by dte bit is disabled 1 interrupt requested by dte bit is enabled 0 1 data transfer activation source compare match/input capture a interrupt from itu channel 0 compare match/input capture a interrupt from itu channel 1 compare match/input capture a interrupt from itu channel 2 compare match/input capture a interrupt from itu channel 3 sci0 transmit-data-empty interrupt sci0 receive-data-full interrupt bit 2 dts1 0 1 0 1 bit 1 dts0 0 1 0 1 0 1 0 bit 0 repeat enable description i/o mode repeat mode idle mode rpe 0 1 dtie 0 1 0 1 if dtsz = 0, mar is incremented by 1 after each transfer if dtsz = 1, mar is incremented by 2 after each transfer if dtsz = 0, mar is decremented by 1 after each transfer if dtsz = 1, mar is decremented by 2 after each transfer transfer in full address mode (channel a) 1 transfer in full address mode (channel a)
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 757 of 872 rej09b0325-0300 dtcr0a?data transfer control register 0a (cont) h'27 dmac0 ? full address mode bit initial value read/write 7 dte 0 r/w 6 dtsz 0 r/w 5 said 0 r/w 4 saide 0 r/w 3 dtie 0 r/w 0 dts0a 0 r/w 2 dts2a 0 r/w 1 dts1a 0 r/w data transfer enable 0 data transfer is disabled 1 data transfer is enabled source address increment/decrement (bit 5) source address increment/decrement enable (bit 4) data transfer interrupt enable data transfer select 0a 0 normal mode 1 block transfer mode data transfer select 2a and 1a set both bits to 1 data transfer size 0 byte-size transfer 1 word-size transfer increment/decrement enable mara is held fixed mara is held fixed decremented: 0 1 0 1 0 1 said bit 5 saide bit 4 incremented: 0 interrupt request by dte bit is disabled 1 interrupt request by dte bit is enabled if dtsz = 0, mara is decremented by 1 after each transfer if dtsz = 1, mara is decremented by 2 after each transfer if dtsz = 0, mara is incremented by 1 after each transfer if dtsz = 1, mara is incremented by 2 after each transfer
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 758 of 872 rej09b0325-0300 mar0b r/e/h/l?memory address register 0b r/e/h/l h'28, h'29, dmac0 h'2a, h'2b bit initial value read/write 30 1 ? 28 1 ? 26 1 ? 24 1 ? 22 r/w 16 r/w 20 r/w 18 r/w 31 1 ? 29 1 ? 27 1 ? 25 1 ? 23 r/w 17 r/w 21 r/w 19 r/w mar0br source or destination address mar0be bit initial value read/write 14 r/w 12 r/w 10 r/w 8 r/w 6 r/w 0 r/w 4 r/w 2 r/w 15 r/w 13 r/w 11 r/w 9 r/w 7 r/w 1 r/w 5 r/w 3 r/w mar0bh mar0bl undetermined undetermined undetermined
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 759 of 872 rej09b0325-0300 etcr0b h/l?execute transfer count register 0b h/l h'2c, h'2d dmac0 ? short address mode ? i/o mode and idle mode bit initial value read/write 14 r/w 12 r/w 10 r/w 8 r/w 6 r/w 0 r/w 4 r/w 2 r/w transfer counter undetermined 15 r/w 13 r/w 11 r/w 9 r/w 7 r/w 1 r/w 5 r/w 3 r/w ? repeat mode bit initial value read/write 7 r/w 6 r/w 5 r/w 4 r/w 3 r/w 0 r/w 2 r/w 1 r/w undetermined transfer counter etcr0bh bit initial value read/write 7 r/w 6 r/w 5 r/w 4 r/w 3 r/w 0 r/w 2 r/w 1 r/w undetermined initial count etcr0bl
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 760 of 872 rej09b0325-0300 etcr0b h/l?execute transfer count register 0b h/l h'2c, h'2d dmac0 (cont) ? full address mode ? normal mode bit initial value read/write 14 r/w 12 r/w 10 r/w 8 r/w 6 r/w 0 r/w 4 r/w 2 r/w not used undetermined 15 r/w 13 r/w 11 r/w 9 r/w 7 r/w 1 r/w 5 r/w 3 r/w ? block transfer mode bit initial value read/write 14 r/w 12 r/w 10 r/w 8 r/w 6 r/w 0 r/w 4 r/w 2 r/w block transfer counter undetermined 15 r/w 13 r/w 11 r/w 9 r/w 7 r/w 1 r/w 5 r/w 3 r/w ioar0b?i/o address register 0b h'2e dmac0 bit initial value read/write 7 r/w 6 r/w 5 r/w 4 r/w 3 r/w 0 r/w 2 r/w 1 r/w short address mode: full address mode: undetermined source or destination address not used
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 761 of 872 rej09b0325-0300 dtcr0b?data transfer control register 0b h'2f dmac0 ? short address mode bit initial value read/write 7 dte 0 r/w 6 dtsz 0 r/w 5 dtid 0 r/w 4 rpe 0 r/w 3 dtie 0 r/w 0 dts0 0 r/w 2 dts2 0 r/w 1 dts1 0 r/w data transfer enable 0 data transfer is disabled 1 data transfer is enabled data transfer size 0 byte-size transfer 1 word-size transfer data transfer increment/decrement 0 incremented: 1 decremented: data transfer select dts2 data transfer interrupt enable 0 interrupt requested by dte bit is disabled 1 interrupt requested by dte bit is enabled an interrupt request is issued to the cpu when the dte bit = 0 0 1 data transfer activation source compare match/input capture a interrupt from itu channel 0 compare match/input capture a interrupt from itu channel 1 compare match/input capture a interrupt from itu channel 2 compare match/input capture a interrupt from itu channel 3 sci0 transmit-data-empty interrupt sci0 receive-data-full interrupt falling edge of input bit 2 dts1 0 1 0 1 bit 1 dts0 0 1 0 1 0 1 bit 0 repeat enable description i/o mode repeat mode idle mode rpe 0 1 dtie 0 1 0 1 0 low level of input 1 dreq dreq if dtsz = 0, mar is incremented by 1 after each transfer if dtsz = 1, mar is incremented by 2 after each transfer if dtsz = 0, mar is decremented by 1 after each transfer if dtsz = 1, mar is decremented by 2 after each transfer
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 762 of 872 rej09b0325-0300 dtcr0b?data transfer control register 0b (cont) h'2f dmac0 ? full address mode bit initial value read/write 7 dtme 0 r/w 6 ? 0 r/w 5 daid 0 r/w 4 daide 0 r/w 3 tms 0 r/w 0 dts0b 0 r/w 2 dts2b 0 r/w 1 dts1b 0 r/w data transfer master enable 0 data transfer is disabled 1 data transfer is enabled destination address increment/decrement (bit 5) destination address increment/decrement enable (bit 4) increment/decrement enable marb is held fixed marb is held fixed decremented: 0 1 0 1 0 1 daid bit 5 daide bit 4 incremented: transfer mode select 0 destination is the block area in block transfer mode 1 source is the block area in block transfer mode data transfer select 2b to 0b dts2b 0 1 normal mode auto-request (burst mode) not available auto-request (cycle-steal mode) not available not available not available falling edge of bit 2 dts1b 0 1 0 1 bit 1 dts0b 0 1 0 1 0 1 bit 0 0 low level input at 1 data transfer activation source block transfer mode compare match/input capture a from itu channel 0 compare match/input capture a from itu channel 1 compare match/input capture a from itu channel 2 compare match/input capture a from itu channel 3 not available not available falling edge of not available dreq dreq dreq if dtsz = 0, marb is incremented by 1 after each transfer if dtsz = 1, marb is incremented by 2 after each transfer if dtsz = 0, marb is decremented by 1 after each transfer if dtsz = 1, marb is decremented by 2 after each transfer
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 763 of 872 rej09b0325-0300 mar1a r/e/h/l?memory address register 1a r/e/h/l h'30, h'31, dmac1 h'32, h'33 bit initial value read/write 30 1 ? 28 1 ? 26 1 ? 24 1 ? 22 r/w 16 r/w 20 r/w 18 r/w 31 1 ? 29 1 ? 27 1 ? 25 1 ? 23 r/w 17 r/w 21 r/w 19 r/w mar1ar mar1ae bit initial value read/write 14 r/w 12 r/w 10 r/w 8 r/w 6 r/w 0 r/w 4 r/w 2 r/w 15 r/w 13 r/w 11 r/w 9 r/w 7 r/w 1 r/w 5 r/w 3 r/w mar1ah mar1al undetermined undetermined undetermined note: bit functions are the same as for dmac0.
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 764 of 872 rej09b0325-0300 etcr1a h/l?execute transfer count register 1a h/l h'34, h'35 dmac1 bit initial value read/write 14 r/w 12 r/w 10 r/w 8 r/w 6 r/w 0 r/w 4 r/w 2 r/w 15 r/w 13 r/w 11 r/w 9 r/w 7 r/w 1 r/w 5 r/w 3 r/w note: bit functions are the same as for dmac0. undetermined bit initial value read/write 7 r/w 6 r/w 5 r/w 4 r/w 3 r/w 0 r/w 2 r/w 1 r/w undetermined bit initial value read/write 7 r/w 6 r/w 5 r/w 4 r/w 3 r/w 0 r/w 2 r/w 1 r/w undetermined etcr1ah etcr1al ioar1a?i/o address register 1a h'36 dmac1 bit initial value read/write 7 r/w 6 r/w 5 r/w 4 r/w 3 r/w 0 r/w 2 r/w 1 r/w undetermined note: bit functions are the same as for dmac0.
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 765 of 872 rej09b0325-0300 dtcr1a?data transfer control register 1a h'37 dmac1 ? short address mode bit initial value read/write 7 dte 0 r/w 6 dtsz 0 r/w 5 dtid 0 r/w 4 rpe 0 r/w 3 dtie 0 r/w 0 dts0 0 r/w 2 dts2 0 r/w 1 dts1 0 r/w ? full address mode bit initial value read/write 7 dte 0 r/w 6 dtsz 0 r/w 5 said 0 r/w 4 saide 0 r/w 3 dtie 0 r/w 0 dts0a 0 r/w 2 dts2a 0 r/w 1 dts1a 0 r/w note: bit functions are the same as for dmac0. mar1b r/e/h/l?memory address register 1b r/e/h/l h'38, h'39, dmac1 h'3a, h'3b bit initial value read/write 30 1 ? 28 1 ? 26 1 ? 24 1 ? 22 r/w 16 r/w 20 r/w 18 r/w 31 1 ? 29 1 ? 27 1 ? 25 1 ? 23 r/w 17 r/w 21 r/w 19 r/w mar1br mar1be bit initial value read/write 14 r/w 12 r/w 10 r/w 8 r/w 6 r/w 0 r/w 4 r/w 2 r/w 15 r/w 13 r/w 11 r/w 9 r/w 7 r/w 1 r/w 5 r/w 3 r/w mar1bh mar1bl undetermined undetermined undetermined note: bit functions are the same as for dmac0.
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 766 of 872 rej09b0325-0300 etcr1b h/l?execute transfer count register 1b h/l h'3c, h'3d dmac1 bit initial value read/write 14 r/w 12 r/w 10 r/w 8 r/w 6 r/w 0 r/w 4 r/w 2 r/w 15 r/w 13 r/w 11 r/w 9 r/w 7 r/w 1 r/w 5 r/w 3 r/w note: bit functions are the same as for dmac0. undetermined bit initial value read/write 7 r/w 6 r/w 5 r/w 4 r/w 3 r/w 0 r/w 2 r/w 1 r/w undetermined bit initial value read/write 7 r/w 6 r/w 5 r/w 4 r/w 3 r/w 0 r/w 2 r/w 1 r/w undetermined etcr1bh etcr1bl ioar1b?i/o address register 1b h'3e dmac1 bit initial value read/write 7 r/w 6 r/w 5 r/w 4 r/w 3 r/w 0 r/w 2 r/w 1 r/w undetermined note: bit functions are the same as for dmac0.
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 767 of 872 rej09b0325-0300 dtcr1b?data transfer control register 1b h'3f dmac1 ? short address mode bit initial value read/write 7 dte 0 r/w 6 dtsz 0 r/w 5 dtid 0 r/w 4 rpe 0 r/w 3 dtie 0 r/w 0 dts0 0 r/w 2 dts2 0 r/w 1 dts1 0 r/w ? full address mode bit initial value read/write 7 dtme 0 r/w 6 ? 0 r/w 5 daid 0 r/w 4 daide 0 r/w 3 tms 0 r/w 0 dts0b 0 r/w 2 dts2b 0 r/w 1 dts1b 0 r/w note: bit functions are the same as for dmac0.
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 768 of 872 rej09b0325-0300 flmcr?flash memory control register h'40 flash memory bit initial value read/write 7 0 v pp ev 6543210 00000 r r/w r/w r/w r/w v e ? 0 ? ? 0 ? pv e p program mode **** * 0 1 r/w exit from program mode (initial value) transition to program mode erase mode 0 1 exit from erase mode (initial value) transition to erase mode program-verify mode 0 1 exit from program-verify mode (initial value) transition to program-verify mode erase-verify mode 0 1 exit from erase-verify mode (initial value) transition to erase-verify mode 0 1 v pp pin 12 v power supply is disabled (initial value) v pp pin 12 v power supply is enabled v enable pp programming power 0 1 cleared when 12 v is not applied to v (initial value) set when 12 v is applied to v pp pp pp note: * the initial value is h'00 in modes 5, 6, and 7 (on-chip flash memory enabled). in modes 1, 2, 3, and 4 (on-chip flash memory disabled), this register cannot be modified and is always read as h'ff. h8/3048f include this register h8/3048b mask rom version h8/3048f-one h8/3048ztat h8/3048 mask rom version h8/3047 mask rom version h8/3045 mask rom version h8/3044 mask rom version not include this register
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 769 of 872 rej09b0325-0300 flmcr1?flash memory control register 1 h'40 flash memory note: * the initial value is h'00 in modes 5, 6, and 7 (on-chip flash memory enabled). in modes 1, 2, 3, and 4 (on-chip flash memory disabled), this register cannot be modified and is always read as h'ff. bit initial value * read/write 7 fwe 1 r 6 swe 0 r/w * 5 esu 0 r/w * 4 psu 0 r/w * 3 ev 0 r/w * 0 p 0 r/w * 2 pv 0 r/w * 1 e 0 r/w * program mode 0 program mode cleared (initial value) 1 transition to program mode erase mode 0 erase mode cleared (initial value) 1 transition to erase mode program-verify mode 0 program-verify mode cleared (initial value) 1 transition to program-verify mode erase-verify mode 0 erase-verify mode cleared (initial value) 1 transition to erase-verify mode program setup bit 0 program setup cleared (initial value) 1 program setup erase setup bit 0 erase setup cleared (initial value) 1 erase setup software write enable bit 0 write disabled (initial value) 1 write enabled flash write enable bit 0 when a low level is input to the fwe pin (hardware protection state) 1 when a high level is input to the fwe pin h8/3048f-one include this register h8/3048b mask rom version h8/3048f h8/3048ztat h8/3048 mask rom version h8/3047 mask rom version h8/3045 mask rom version h8/3044 mask rom version not include this register
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 770 of 872 rej09b0325-0300 flmcr2?flash memory control register 2 h'41 flash memory bit initial value read/write 7 fler 0 r 6 ? 0 r/w 5 ? 0 r/w 4 ? 0 r/w 3 ? 0 r/w 0 ? 0 r/w 2 ? 0 r/w 1 ? 0 r/w reserved bits h8/3048f-one include this register h8/3048b mask rom version h8/3048f h8/3048ztat h8/3048 mask rom version h8/3047 mask rom version h8/3045 mask rom version h8/3044 mask rom version not include this register flash memory error 0 flash memory is operating normally. flash memory program/erase protection (error protection) is disabled. (initial value) 1 note: bits 6 to 0 are reserved bits but are readable/writable. this indicates that an error has occurred during flash memory programming/erasing. flash memory program/erase protection (error protection) is enabled.
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 771 of 872 rej09b0325-0300 ebr1?erase block register 1 h'42 flash memory bit initial value read/write 7 0 lb7 6543210 0 0000 r/w r/w r/w r/w * 00 lb6 lb5 lb4 lb3 lb2 lb1 lb0 **** r/w r/w r/w ** * r/w * large block 7 to 0 0 1 block lb7 to lb0 is not selected (initial value) block lb7 to lb0 is selected note: * the initial value is h'00 in modes 5, 6, and 7 (on-chip flash memory enabled). in modes 1, 2, 3, and 4 (on-chip flash memory disabled), this register cannot be modified and is always read as h'ff. h8/3048f include this register h8/3048b mask rom version h8/3048f-one h8/3048ztat h8/3048 mask rom version h8/3047 mask rom version h8/3045 mask rom version h8/3044 mask rom version not include this register
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 772 of 872 rej09b0325-0300 ebr?erase block register h'42 flash memory bit initial value read/write 7 0 eb7 6543210 0 0000 r/w r/w r/w r/w * 00 e b6 e b5 e b4 e b3 e b2 e b1 e b0 **** r/w r/w r/w ** * r/w * erase block specification bits (1) 0 1 erase protection state erasable state note: * the initial value is h'00 in modes 5, 6, and 7 (on-chip rom enabled). in modes 1, 2, 3, and 4 (on-chip rom disabled), this register cannot be modified and is always read as h'00. h8/3048f-one include this register h8/3048b mask rom version h8/3048f h8/3048ztat h8/3048 mask rom version h8/3047 mask rom version h8/3045 mask rom version h8/3044 mask rom version not include this register
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 773 of 872 rej09b0325-0300 ebr2?erase block register 2 h'43 flash memory bit initial value read/write 7 0 sb7 6543210 0 0000 r/w r/w r/w r/w * 00 sb6 sb5 sb4 sb3 sb2 sb1 sb0 **** r/w r/w r/w ** * r/w * small block 7 to 0 0 1 block sb7 to sb0 is not selected (initial value) block sb7 to sb0 is selected note: * the initial value is h'00 in modes 5, 6, and 7 (on-chip flash memory enabled). in modes 1, 2, 3, and 4 (on-chip flash memory disabled), this register cannot be modified and is always read as h'ff. h8/3048f include this register h8/3048b mask rom version h8/3048f-one h8/3048ztat h8/3048 mask rom version h8/3047 mask rom version h8/3045 mask rom version h8/3044 mask rom version not include this register
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 774 of 872 rej09b0325-0300 ramcr?ram control register h'47 flash memory ram select, ram2, ram1 ram area ram emulation status bit 3 rams 0 bit 2 ram2 0/1 bit 1 ram1 0/1 0 1 0 1 h'fff000 to h'fff3ff h'000000 to h'0003ff h'000400 to h'0007ff h'000800 to h'000bff h'000c00 to h'000fff no emulation mapping ram 0 1 1 1 ? 1 ? 1 ? 1 ? 0 r/w 0 r/w 0 r/w 0 r/w initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 rams 0 r 0 ? 0 ? 2 ram2 0 r 1 ram1 0 r bit initial value read/write reserved bits modes 5 to 7 modes 1 to 4 note: bits 7 to 4 are reserved and cannot be modified. if data is written to these bits, normal operation is not guaranteed. bit 0 is a reserved bit but is readable/writable. h8/3048f-one include this register h8/3048b mask rom version h8/3048f h8/3048ztat h8/3048 mask rom version h8/3047 mask rom version h8/3045 mask rom version h8/3044 mask rom version not include this register
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 775 of 872 rej09b0325-0300 ramcr?ram control register h'48 flash memory bit initial value read/write 7 0 fler 6543210 0000 r/w r/w r/w r/w r/w ? 1 ? ? 1 ? ? 1 ? rams ram2 ram1 ram0 ram select, ram 2 to ram 0 bit 3 rams 0 ram area bit 2 ram 2 1/0 bit 1 ram 1 1/0 bit 0 ram 0 1/0 0 1 0 1 0 1 0 1 h'fff000 to h'fff1ff h'01f000 to h'01f1ff h'01f200 to h'01f3ff h'01f400 to h'01f5ff h'01f600 to h'01f7ff h'01f800 to h'01f9ff h'01fa00 to h'01fbff h'01fc00 to h'01fdff h'01fe00 to h'01ffff 0 1 0 1 0 1 1 flash memory error 0 1 flash memory is not write/erase-protected (initial value) (is not in error protect mode) flash memory is write/erase-protected (is in error protect mode) h8/3048f include this register h8/3048b mask rom version h8/3048f-one h8/3048ztat h8/3048 mask rom version h8/3047 mask rom version h8/3045 mask rom version h8/3044 mask rom version not include this register
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 776 of 872 rej09b0325-0300 dastcr?d/a standby control register h'5c system control bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 ? 1 ? 0 daste 0 r/w 2 ? 1 ? 1 ? 1 ? d/a standby enable 0 d/a output is disabled in software standby mode (initial value) 1 d/a output is enabled in software standby mode divcr?division control register h'5d system control bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 3 ? 1 ? 0 div0 0 r/w 2 ? 1 ? 1 div1 0 r/w divide 1 and 0 div1 frequency division ratio div0 bit 0 bit 1 0 1 1/1 (initial value) 1/2 1/4 1/8 0 0 1 1 7 ? 1 ?
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 777 of 872 rej09b0325-0300 mstcr?module standby control register h'5e system control module standby 3 bit initial value read/write 7 pstop 0 r/w 6 ? 1 ? 5 mstop5 0 r/w 4 mstop4 0 r/w 3 mstop3 0 r/w 0 mstop0 0 r/w 2 mstop2 0 r/w 1 mstop1 0 r/w module standby 0 0 a/d converter operates normally (initial value) 1 a/d converter is in standby state 0 sci1 operates normally (initial value) 1 sci1 is in standby state module standby 1 0 refresh controller operates normally (initial value) 1 refresh controller is in standby state module standby 2 0 dmac operates normally (initial value) 1 dmac is in standby state module standby 4 0 sci0 operates normally (initial value) 1 sci0 is in standby state module standby 5 0 itu operates normally (initial value) 1 itu is in standby state clock stop 0 clock output is enabled (initial value) 1 clock output is disabled
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 778 of 872 rej09b0325-0300 cscr?chip select control register h'5f system control bit initial value read/write 7 cs7e 0 r/w 6 cs6e 0 r/w 5 cs5e 0 r/w 4 cs4e 0 r/w 3 ? 1 ? 0 ? 1 ? 2 ? 1 ? 1 ? 1 ? chip select 7 to 4 enable (n = 7 to 4) output of chip select signal csn is disabled (initial value) output of chip select signal csn is enabled bit n 0 1 description csne tstr?timer start register h'60 itu (all channels) bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 str4 0 r/w 3 str3 0 r/w 0 str0 0 r/w 2 str2 0 r/w 1 str1 0 r/w counter start 0 0 tcnt0 is halted 1 tcnt0 is counting counter start 3 0 tcnt3 is halted 1 tcnt3 is counting counter start 1 0 tcnt1 is halted 1 tcnt1 is counting counter start 2 0 tcnt2 is halted 1 tcnt2 is counting counter start 4 0 tcnt4 is halted 1 tcnt4 is counting
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 779 of 872 rej09b0325-0300 tsnc?timer synchro register h'61 itu (all channels) bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 sync4 0 r/w 3 sync3 0 r/w 0 sync0 0 r/w 2 sync2 0 r/w 1 sync1 0 r/w timer sync 0 0 tcnt0 operates independently 1 tcnt0 is synchronized timer sync 3 0 tcnt3 operates independently 1 tcnt3 is synchronized timer sync 1 0 tcnt1 operates independently 1 tcnt1 is synchronized timer sync 2 0 tcnt2 operates independently 1 tcnt2 is synchronized timer sync 4 0 tcnt4 operates independently 1 tcnt4 is synchronized
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 780 of 872 rej09b0325-0300 tmdr?timer mode register h'62 itu (all channels) bit initial value read/write 7 ? 1 ? 6 mdf 0 r/w 5 fdir 0 r/w 4 pwm4 0 r/w 3 pwm3 0 r/w 0 pwm0 0 r/w 2 pwm2 0 r/w 1 pwm1 0 r/w pwm mode 0 0 channel 0 operates normally 1 channel 0 operates in pwm mode pwm mode 3 0 channel 3 operates normally 1 channel 3 operates in pwm mode pwm mode 1 0 channel 1 operates normally 1 channel 1 operates in pwm mode pwm mode 2 0 channel 2 operates normally 1 channel 2 operates in pwm mode pwm mode 4 0 channel 4 operates normally 1 channel 4 operates in pwm mode flag direction 0 ovf is set to 1 in tsr2 when tcnt2 overflows or underflows 1 ovf is set to 1 in tsr2 when tcnt2 overflows phase counting mode flag 0 channel 2 operates normally 1 channel 2 operates in phase counting mode
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 781 of 872 rej09b0325-0300 tfcr?timer function control register h'63 itu (all channels) bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 cmd1 0 r/w 4 cmd0 0 r/w 3 bfb4 0 r/w 0 bfa3 0 r/w 2 bfa4 0 r/w 1 bfb3 0 r/w buffer mode a3 0 gra3 operates normally 1 gra3 is buffered by bra3 buffer mode b4 0 grb4 operates normally 1 grb4 is buffered by brb4 buffer mode b3 0 grb3 operates normally 1 grb3 is buffered by brb3 buffer mode a4 0 gra4 operates normally 1 gra4 is buffered by bra4 combination mode 1 and 0 channels 3 and 4 operate normally channels 3 and 4 operate together in complementary pwm mode channels 3 and 4 operate together in reset-synchronized pwm mode bit 5 0 1 bit 4 0 1 0 1 operating mode of channels 3 and 4 cmd1 cmd0
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 782 of 872 rej09b0325-0300 tcr0?timer control register 0 h'64 itu0 bit initial value read/write 7 ? 1 ? 6 cclr1 0 r/w 5 cclr0 0 r/w 4 ckeg1 0 r/w 3 ckeg0 0 r/w 0 tpsc0 0 r/w 2 tpsc2 0 r/w 1 tpsc1 0 r/w timer prescaler 2 to 0 clock edge 1 and 0 counter clear 1 and 0 tcnt is not cleared tcnt is cleared by grb compare match or input capture synchronous clear: tcnt is cleared in synchronization with other synchronized timers bit 6 0 1 bit 5 0 0 1 tcnt clear source cclr1 cclr0 tcnt is cleared by gra compare match or input capture 1 rising edges counted both edges counted bit 4 0 1 bit 3 0 ? counted edges of external clock ckeg1 ckeg0 falling edges counted 1 tpsc2 1 tcnt clock source internal clock: internal clock: /2 internal clock: /4 internal clock: /8 external clock a: tclka input external clock b: tclkb input external clock c: tclkc input bit 2 tpsc1 0 1 0 1 bit 1 tpsc0 0 1 0 1 0 1 bit 0 0 external clock d: tclkd input 1 0
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 783 of 872 rej09b0325-0300 tior0?timer i/o control register 0 h'65 itu0 bit initial value read/write 7 ? 1 ? 6 iob2 0 r/w 5 iob1 0 r/w 4 iob0 0 r/w 3 ? 1 ? 0 ioa0 0 r/w 2 ioa2 0 r/w 1 ioa1 0 r/w i/o control a2 to a0 ioa2 1 gra function gra is an output compare register gra is an input capture register ioa1 0 1 0 1 bit 1 ioa0 0 1 0 1 0 1 bit 0 0 1 0 bit 2 no output at compare match 0 output at gra compare match 1 output at gra compare match output toggles at gra compare match gra captures rising edge of input gra captures falling edge of input gra captures both edges of input i/o control b2 to b0 iob2 1 grb function grb is an output compare register grb is an input capture register iob1 0 1 0 1 bit 5 iob0 0 1 0 1 0 1 bit 4 0 1 0 bit 6 no output at compare match 0 output at grb compare match 1 output at grb compare match output toggles at grb compare match grb captures rising edge of input grb captures falling edge of input grb captures both edges of input
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 784 of 872 rej09b0325-0300 tier0?timer interrupt enable register 0 h'66 itu0 bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 ? 1 ? 0 imiea 0 r/w 2 ovie 0 r/w 1 imieb 0 r/w input capture/compare match interrupt enable a 0 imia interrupt requested by imfa flag is disabled 1 imia interrupt requested by imfa flag is enabled input capture/compare match interrupt enable b 0 imib interrupt requested by imfb flag is disabled 1 imib interrupt requested by imfb flag is enabled overflow interrupt enable 0 ovi interrupt requested by ovf flag is disabled 1 ovi interrupt requested by ovf flag is enabled
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 785 of 872 rej09b0325-0300 tsr0?timer status register 0 h'67 itu0 bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 ? 1 ? 0 imfa 0 r/(w) 2 ovf 0 r/(w) 1 imfb 0 r/(w) input capture/compare match flag a 0 [clearing condition] overflow flag *** read imfa when imfa = 1, then write 0 in imfa 1 [setting conditions] tcnt = gra when gra functions as an output compare register. tcnt value is transferred to gra by an input capture signal, when gra functions as an input capture register. input capture/compare match flag b 0 [clearing condition] read imfb when imfb = 1, then write 0 in imfb 1 [setting conditions] tcnt = grb when grb functions as an output compare register. tcnt value is transferred to grb by an input capture signal, when grb functions as an input capture register. 0 [clearing condition] read ovf when ovf = 1, then write 0 in ovf 1 [setting condition] tcnt overflowed from h'ffff to h'0000 or underflowed from h'0000 to h'ffff note: * only 0 can be written, to clear the flag.
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 786 of 872 rej09b0325-0300 tcnt0 h/l?timer counter 0 h/l h'68, h'69 itu0 bit initial value read/write 14 0 r/w 12 0 r/w 10 0 r/w 8 0 r/w 6 0 r/w 0 0 r/w 4 0 r/w 2 0 r/w up-counter 15 0 r/w 13 0 r/w 11 0 r/w 9 0 r/w 7 0 r/w 1 0 r/w 5 0 r/w 3 0 r/w gra0 h/l?general register a0 h/l h'6a, h'6b itu0 bit initial value read/write 14 1 r/w 12 1 r/w 10 1 r/w 8 1 r/w 6 1 r/w 0 1 r/w 4 1 r/w 2 1 r/w output compare or input capture register 15 1 r/w 13 1 r/w 11 1 r/w 9 1 r/w 7 1 r/w 1 1 r/w 5 1 r/w 3 1 r/w grb0 h/l?general register b0 h/l h'6c, h'6d itu0 bit initial value read/write 14 1 r/w 12 1 r/w 10 1 r/w 8 1 r/w 6 1 r/w 0 1 r/w 4 1 r/w 2 1 r/w output compare or input capture register 15 1 r/w 13 1 r/w 11 1 r/w 9 1 r/w 7 1 r/w 1 1 r/w 5 1 r/w 3 1 r/w tcr1?timer control register 1 h'6e itu1 bit initial value read/write 7 ? 1 ? 6 cclr1 0 r/w 5 cclr0 0 r/w 4 ckeg1 0 r/w 3 ckeg0 0 r/w 0 tpsc0 0 r/w 2 tpsc2 0 r/w 1 tpsc1 0 r/w note: bit functions are the same as for itu0.
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 787 of 872 rej09b0325-0300 tior1?timer i/o control register 1 h'6f itu1 bit initial value read/write 7 ? 1 ? 6 iob2 0 r/w 5 iob1 0 r/w 4 iob0 0 r/w 3 ? 1 ? 0 ioa0 0 r/w 2 ioa2 0 r/w 1 ioa1 0 r/w note: bit functions are the same as for itu0. tier1?timer interrupt enable register 1 h'70 itu1 bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 ? 1 ? 0 imiea 0 r/w 2 ovie 0 r/w 1 imieb 0 r/w note: bit functions are the same as for itu0. tsr1?timer status register 1 h'71 itu1 bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 ? 1 ? 0 imfa 0 r/(w) 2 ovf 0 r/(w) 1 imfb 0 r/(w) notes: *** bit functions are the same as for itu0. * only 0 can be written, to clear the flag. tcnt1 h/l?timer counter 1 h/l h'72, h'73 itu1 bit initial value read/write 14 0 r/w 12 0 r/w 10 0 r/w 8 0 r/w 6 0 r/w 0 0 r/w 4 0 r/w 2 0 r/w 15 0 r/w 13 0 r/w 11 0 r/w 9 0 r/w 7 0 r/w 1 0 r/w 5 0 r/w 3 0 r/w note: bit functions are the same as for itu0.
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 788 of 872 rej09b0325-0300 gra1 h/l?general register a1 h/l h'74, h'75 itu1 bit initial value read/write 14 1 r/w 12 1 r/w 10 1 r/w 8 1 r/w 6 1 r/w 0 1 r/w 4 1 r/w 2 1 r/w 15 1 r/w 13 1 r/w 11 1 r/w 9 1 r/w 7 1 r/w 1 1 r/w 5 1 r/w 3 1 r/w note: bit functions are the same as for itu0. grb1 h/l?general register b1 h/l h'76, h'77 itu1 bit initial value read/write 14 1 r/w 12 1 r/w 10 1 r/w 8 1 r/w 6 1 r/w 0 1 r/w 4 1 r/w 2 1 r/w 15 1 r/w 13 1 r/w 11 1 r/w 9 1 r/w 7 1 r/w 1 1 r/w 5 1 r/w 3 1 r/w note: bit functions are the same as for itu0. tcr2?timer control register 2 h'78 itu2 bit initial value read/write 7 ? 1 ? 6 cclr1 0 r/w 5 cclr0 0 r/w 4 ckeg1 0 r/w 3 ckeg0 0 r/w 0 tpsc0 0 r/w 2 tpsc2 0 r/w 1 tpsc1 0 r/w notes: bit functions are the same as for itu0. when channel 2 is used in phase counting mode, the counter clock source selection by bits tpsc2 to tpsc0 is ignored. 1. 2.
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 789 of 872 rej09b0325-0300 tior2?timer i/o control register 2 h'79 itu2 bit initial value read/write 7 ? 1 ? 6 iob2 0 r/w 5 iob1 0 r/w 4 iob0 0 r/w 3 ? 1 ? 0 ioa0 0 r/w 2 ioa2 0 r/w 1 ioa1 0 r/w note: bit functions are the same as for itu0. tier2?timer interrupt enable register 2 h'7a itu2 bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 ? 1 ? 0 imiea 0 r/w 2 ovie 0 r/w 1 imieb 0 r/w note: bit functions are the same as for itu0. tsr2?timer status register 2 h'7b itu2 bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 ? 1 ? 0 imfa 0 r/(w) 2 ovf 0 r/(w) 1 imfb 0 r/(w) *** notes: bit functions are the same as for itu0. * only 0 can be written, to clear the flag. overflow flag [clearing condition] read ovf when ovf = 1, then write 0 in ovf. [setting condition] the tcnt value overflows (from h'ffff to h'0000) or underflows (from h'0000 to h'ffff) 0 1 the function is the same as itu0.
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 790 of 872 rej09b0325-0300 tcnt2 h/l?timer counter 2 h/l h'7c, h'7d itu2 bit initial value read/write 14 0 r/w 12 0 r/w 10 0 r/w 8 0 r/w 6 0 r/w 0 0 r/w 4 0 r/w 2 0 r/w phase counting mode: other modes: 15 0 r/w 13 0 r/w 11 0 r/w 9 0 r/w 7 0 r/w 1 0 r/w 5 0 r/w 3 0 r/w up/down counter up-counter gra2 h/l?general register a2 h/l h'7e, h'7f itu2 bit initial value read/write 14 1 r/w 12 1 r/w 10 1 r/w 8 1 r/w 6 1 r/w 0 1 r/w 4 1 r/w 2 1 r/w 15 1 r/w 13 1 r/w 11 1 r/w 9 1 r/w 7 1 r/w 1 1 r/w 5 1 r/w 3 1 r/w note: bit functions are the same as for itu0. grb2 h/l?general register b2 h/l h'80, h'81 itu2 bit initial value read/write 14 1 r/w 12 1 r/w 10 1 r/w 8 1 r/w 6 1 r/w 0 1 r/w 4 1 r/w 2 1 r/w 15 1 r/w 13 1 r/w 11 1 r/w 9 1 r/w 7 1 r/w 1 1 r/w 5 1 r/w 3 1 r/w note: bit functions are the same as for itu0.
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 791 of 872 rej09b0325-0300 tcr3?timer control register 3 h'82 itu3 bit initial value read/write 7 ? 1 ? 6 cclr1 0 r/w 5 cclr0 0 r/w 4 ckeg1 0 r/w 3 ckeg0 0 r/w 0 tpsc0 0 r/w 2 tpsc2 0 r/w 1 tpsc1 0 r/w note: bit functions are the same as for itu0. tior3?timer i/o control register 3 h'83 itu3 bit initial value read/write 7 ? 1 ? 6 iob2 0 r/w 5 iob1 0 r/w 4 iob0 0 r/w 3 ? 1 ? 0 ioa0 0 r/w 2 ioa2 0 r/w 1 ioa1 0 r/w note: bit functions are the same as for itu0. tier3?timer interrupt enable register 3 h'84 itu3 bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 ? 1 ? 0 imiea 0 r/w 2 ovie 0 r/w 1 imieb 0 r/w note: bit functions are the same as for itu0.
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 792 of 872 rej09b0325-0300 tsr3?timer status register 3 h'85 itu3 bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 ? 1 ? 0 imfa 0 r/(w) 2 ovf 0 r/(w) 1 imfb 0 r/(w) *** overflow flag 0 [clearing condition] read ovf when ovf = 1, then write 1 in ovf 1 [setting condition] tcnt overflowed from h'ffff to h'0000 or underflowed from h'0000 to h'ffff bit functions are the same as for itu0 note: * only 0 can be written, to clear the flag. tcnt3 h/l?timer counter 3 h/l h'86, h'87 itu3 bit initial value read/write 14 0 r/w 12 0 r/w 10 0 r/w 8 0 r/w 6 0 r/w 0 0 r/w 4 0 r/w 2 0 r/w complementary pwm mode: other modes: 15 0 r/w 13 0 r/w 11 0 r/w 9 0 r/w 7 0 r/w 1 0 r/w 5 0 r/w 3 0 r/w up/down counter up-counter gra3 h/l?general register a3 h/l h'88, h'89 itu3 bit initial value read/write 14 1 r/w 12 1 r/w 10 1 r/w 8 1 r/w 6 1 r/w 0 1 r/w 4 1 r/w 2 1 r/w output compare or input capture register (can be buffered) 15 1 r/w 13 1 r/w 11 1 r/w 9 1 r/w 7 1 r/w 1 1 r/w 5 1 r/w 3 1 r/w
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 793 of 872 rej09b0325-0300 grb3 h/l?general register b3 h/l h'8a, h'8b itu3 bit initial value read/write 14 1 r/w 12 1 r/w 10 1 r/w 8 1 r/w 6 1 r/w 0 1 r/w 4 1 r/w 2 1 r/w output compare or input capture register (can be buffered) 15 1 r/w 13 1 r/w 11 1 r/w 9 1 r/w 7 1 r/w 1 1 r/w 5 1 r/w 3 1 r/w bra3 h/l?buffer register a3 h/l h'8c, h'8d itu3 bit initial value read/write 14 1 r/w 12 1 r/w 10 1 r/w 8 1 r/w 6 1 r/w 0 1 r/w 4 1 r/w 2 1 r/w used to buffer gra 15 1 r/w 13 1 r/w 11 1 r/w 9 1 r/w 7 1 r/w 1 1 r/w 5 1 r/w 3 1 r/w brb3 h/l?buffer register b3 h/l h'8e, h'8f itu3 bit initial value read/write 14 1 r/w 12 1 r/w 10 1 r/w 8 1 r/w 6 1 r/w 0 1 r/w 4 1 r/w 2 1 r/w used to buffer grb 15 1 r/w 13 1 r/w 11 1 r/w 9 1 r/w 7 1 r/w 1 1 r/w 5 1 r/w 3 1 r/w
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 794 of 872 rej09b0325-0300 toer?timer output enable register h'90 itu (all channels) bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 exb4 1 r/w 4 exa4 1 r/w 3 eb3 1 r/w 0 ea3 1 r/w 2 eb4 1 r/w 1 ea4 1 r/w master enable tioca3 0 tioca output is disabled regardless of tior3, tmdr, and tfcr settings 1 tioca is enabled for output according to tior3, tmdr, and tfcr settings master enable tiocb3 0 tiocb output is disabled regardless of tior3 and tfcr settings 1 tiocb is enabled for output according to tior3 and tfcr settings master enable tioca4 0 tioca output is disabled regardless of tior4, tmdr, and tfcr settings 1 tioca is enabled for output according to tior4, tmdr, and tfcr settings master enable tiocb4 0 tiocb output is disabled regardless of tior4 and tfcr settings 1 tiocb is enabled for output according to tior4 and tfcr settings master enable tocxa4 0 tocxa output is disabled regardless of tfcr settings 1 tocxa is enabled for output according to tfcr settings master enable tocxb4 0 tocxb output is disabled regardless of tfcr settings 1 tocxb is enabled for output according to tfcr settings 4 4 4 4 3 3 4 4 4 4 3 3
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 795 of 872 rej09b0325-0300 tocr?timer output control register h'91 itu (all channels) bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 1 r/w 3 ? 1 ? 0 ols3 1 r/w 2 ? 1 ? 1 ols4 1 r/w output level select 3 0 tiocb , tocxa , and tocxb outputs are inverted 1 tiocb , tocxa , and tocxb outputs are not inverted output level select 4 0 tioca , tioca , and tiocb outputs are inverted 1 tioca , tioca , and tiocb outputs are not inverted external trigger disable 0 input capture a in channel 1 is used as an external trigger signal in reset-synchronized pwm mode and complementary pwm mode 1 external triggering is disabled xtgd note: * when an external trigger occurs, bits 5 to 0 in toer are cleared to 0, disabling itu output. 3 3 3 3 4 4 4 4 4 4 4 4 *
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 796 of 872 rej09b0325-0300 tcr4?timer control register 4 h'92 itu4 bit initial value read/write 7 ? 1 ? 6 cclr1 0 r/w 5 cclr0 0 r/w 4 ckeg1 0 r/w 3 ckeg0 0 r/w 0 tpsc0 0 r/w 2 tpsc2 0 r/w 1 tpsc1 0 r/w note: bit functions are the same as for itu0. tior4?timer i/o control register 4 h'93 itu4 bit initial value read/write 7 ? 1 ? 6 iob2 0 r/w 5 iob1 0 r/w 4 iob0 0 r/w 3 ? 1 ? 0 ioa0 0 r/w 2 ioa2 0 r/w 1 ioa1 0 r/w note: bit functions are the same as for itu0. tier4?timer interrupt enable register 4 h'94 itu4 bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 ? 1 ? 0 imiea 0 r/w 2 ovie 0 r/w 1 imieb 0 r/w note: bit functions are the same as for itu0. tsr4?timer status register 4 h'95 itu4 bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 ? 1 ? 0 imfa 0 r/(w) 2 ovf 0 r/(w) 1 imfb 0 r/(w) *** notes: bit functions are the same as for itu0. * only 0 can be written, to clear the flag.
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 797 of 872 rej09b0325-0300 tcnt4 h/l?timer counter 4 h/l h'96, h'97 itu4 bit initial value read/write 14 0 r/w 12 0 r/w 10 0 r/w 8 0 r/w 6 0 r/w 0 0 r/w 4 0 r/w 2 0 r/w 15 0 r/w 13 0 r/w 11 0 r/w 9 0 r/w 7 0 r/w 1 0 r/w 5 0 r/w 3 0 r/w note: bit functions are the same as for itu3. gra4 h/l?general register a4 h/l h'98, h'99 itu4 bit initial value read/write 14 1 r/w 12 1 r/w 10 1 r/w 8 1 r/w 6 1 r/w 0 1 r/w 4 1 r/w 2 1 r/w 15 1 r/w 13 1 r/w 11 1 r/w 9 1 r/w 7 1 r/w 1 1 r/w 5 1 r/w 3 1 r/w note: bit functions are the same as for itu3. grb4 h/l?general register b4 h/l h'9a, h'9b itu4 bit initial value read/write 14 1 r/w 12 1 r/w 10 1 r/w 8 1 r/w 6 1 r/w 0 1 r/w 4 1 r/w 2 1 r/w 15 1 r/w 13 1 r/w 11 1 r/w 9 1 r/w 7 1 r/w 1 1 r/w 5 1 r/w 3 1 r/w note: bit functions are the same as for itu3. bra4 h/l?buffer register a4 h/l h'9c, h'9d itu4 bit initial value read/write 14 1 r/w 12 1 r/w 10 1 r/w 8 1 r/w 6 1 r/w 0 1 r/w 4 1 r/w 2 1 r/w 15 1 r/w 13 1 r/w 11 1 r/w 9 1 r/w 7 1 r/w 1 1 r/w 5 1 r/w 3 1 r/w note: bit functions are the same as for itu3.
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 798 of 872 rej09b0325-0300 brb4 h/l?buffer register b4 h/l h'9e, h'9f itu4 bit initial value read/write 14 1 r/w 12 1 r/w 10 1 r/w 8 1 r/w 6 1 r/w 0 1 r/w 4 1 r/w 2 1 r/w 15 1 r/w 13 1 r/w 11 1 r/w 9 1 r/w 7 1 r/w 1 1 r/w 5 1 r/w 3 1 r/w note: bit functions are the same as for itu3. tpmr?tpc output mode register h'a0 tpc bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 g3nov 0 r/w 0 g0nov 0 r/w 2 g2nov 0 r/w 1 g1nov 0 r/w group 3 non-overlap 0 normal tpc output in group 3 output values change at compare match a in the selected itu channel 1 non-overlapping tpc output in group 3, controlled by compare match a and b in the selected itu channel group 2 non-overlap 0 normal tpc output in group 2 output values change at compare match a in the selected itu channel 1 non-overlapping tpc output in group 2, controlled by compare match a and b in the selected itu channel group 1 non-overlap 0 normal tpc output in group 1 output values change at compare match a in the selected itu channel 1 non-overlapping tpc output in group 1, controlled by compare match a and b in the selected itu channel group 0 non-overlap 0 normal tpc output in group 0 output values change at compare match a in the selected itu channel 1 non-overlapping tpc output in group 0, controlled by compare match a and b in the selected itu channel
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 799 of 872 rej09b0325-0300 tpcr?tpc output control register h'a1 tpc bit initial value read/write 7 g3cms1 1 r/w 6 g3cms0 1 r/w 5 g2cms1 1 r/w 4 g2cms0 1 r/w 3 g1cms1 1 r/w 0 g0cms0 1 r/w 2 g1cms0 1 r/w 1 g0cms1 1 r/w group 3 compare match select 1 and 0 tpc output group 3 (tp to tp ) is triggered by compare match in itu channel 0 tpc output group 3 (tp to tp ) is triggered by compare match in itu channel 2 tpc output group 3 (tp to tp ) is triggered by compare match in itu channel 3 bit 7 0 1 bit 6 0 0 1 itu channel selected as output trigger g3cms1 g3cms0 tpc output group 3 (tp to tp ) is triggered by compare match in itu channel 1 1 15 15 15 15 12 12 12 12 group 2 compare match select 1 and 0 tpc output group 2 (tp to tp ) is triggered by compare match in itu channel 0 tpc output group 2 (tp to tp ) is triggered by compare match in itu channel 2 tpc output group 2 (tp to tp ) is triggered by compare match in itu channel 3 bit 5 0 1 bit 4 0 0 1 itu channel selected as output trigger g2cms1 g2cms0 tpc output group 2 (tp to tp ) is triggered by compare match in itu channel 1 1 11 11 11 11 8 8 8 8 group 1 compare match select 1 and 0 tpc output group 1 (tp to tp ) is triggered by compare match in itu channel 0 tpc output group 1 (tp to tp ) is triggered by compare match in itu channel 2 tpc output group 1 (tp to tp ) is triggered by compare match in itu channel 3 bit 3 0 1 bit 2 0 0 1 itu channel selected as output trigger g1cms1 g1cms0 tpc output group 1 (tp to tp ) is triggered by compare match in itu channel 1 1 7 7 7 7 4 4 4 4 group 0 compare match select 1 and 0 tpc output group 0 (tp to tp ) is triggered by compare match in itu channel 0 tpc output group 0 (tp to tp ) is triggered by compare match in itu channel 2 tpc output group 0 (tp to tp ) is triggered by compare match in itu channel 3 bit 1 0 1 bit 0 0 0 1 itu channel selected as output trigger g0cms1 g0cms0 tpc output group 0 (tp to tp ) is triggered by compare match in itu channel 1 1 3 3 3 3 0 0 0 0
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 800 of 872 rej09b0325-0300 nderb?next data enable register b h'a2 tpc bit initial value read/write 7 nder15 0 r/w 6 nder14 0 r/w 5 nder13 0 r/w 4 nder12 0 r/w 3 nder11 0 r/w 0 nder8 0 r/w 2 nder10 0 r/w 1 nder9 0 r/w next data enable 15 to 8 tpc outputs tp to tp are disabled (ndr15 to ndr8 are not transferred to pb to pb ) tpc outputs tp to tp are enabled (ndr15 to ndr8 are transferred to pb to pb ) bits 7 to 0 0 1 description nder15 to nder8 15 15 8 8 7 7 0 0 ndera?next data enable register a h'a3 tpc bit initial value read/write 7 nder7 0 r/w 6 nder6 0 r/w 5 nder5 0 r/w 4 nder4 0 r/w 3 nder3 0 r/w 0 nder0 0 r/w 2 nder2 0 r/w 1 nder1 0 r/w next data enable 7 to 0 tpc outputs tp to tp are disabled (ndr7 to ndr0 are not transferred to pa to pa ) tpc outputs tp to tp are enabled (ndr7 to ndr0 are transferred to pa to pa ) bits 7 to 0 0 1 description nder7 to nder0 7 7 0 0 7 7 0 0
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 801 of 872 rej09b0325-0300 ndrb?next data register b h'a4/h'a6 tpc ? same trigger for tpc output groups 2 and 3 ? address h'ffa4 bit initial value read/write 7 ndr15 0 r/w 6 ndr14 0 r/w 5 ndr13 0 r/w 4 ndr12 0 r/w 3 ndr11 0 r/w 0 ndr8 0 r/w 2 ndr10 0 r/w 1 ndr9 0 r/w store the next output data for tpc output group 3 store the next output data for tpc output group 2 ? address h'ffa6 bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 ? 1 ? 0 ? 1 ? 2 ? 1 ? 1 ? 1 ? ? different triggers for tpc output groups 2 and 3 ? address h'ffa4 bit initial value read/write 7 ndr15 0 r/w 6 ndr14 0 r/w 5 ndr13 0 r/w 4 ndr12 0 r/w 3 ? 1 ? 0 ? 1 ? 2 ? 1 ? 1 ? 1 ? store the next output data for tpc output group 3 ? address h'ffa6 bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 ndr11 0 r/w 0 ndr8 0 r/w 2 ndr10 0 r/w 1 ndr9 0 r/w store the next output data for tpc output group 2
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 802 of 872 rej09b0325-0300 ndra?next data register a h'a5/h'a7 tpc ? same trigger for tpc output groups 0 and 1 ? address h'ffa5 bit initial value read/write 7 ndr7 0 r/w 6 ndr6 0 r/w 5 ndr5 0 r/w 4 ndr4 0 r/w 3 ndr3 0 r/w 0 ndr0 0 r/w 2 ndr2 0 r/w 1 ndr1 0 r/w store the next output data for tpc output group 1 store the next output data for tpc output group 0 ? address h'ffa7 bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 ? 1 ? 0 ? 1 ? 2 ? 1 ? 1 ? 1 ? ? different triggers for tpc output groups 0 and 1 ? address h'ffa5 bit initial value read/write 7 ndr7 0 r/w 6 ndr6 0 r/w 5 ndr5 0 r/w 4 ndr4 0 r/w 3 ? 1 ? 0 ? 1 ? 2 ? 1 ? 1 ? 1 ? store the next output data for tpc output group 1 ? address h'ffa7 bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 ndr3 0 r/w 0 ndr0 0 r/w 2 ndr2 0 r/w 1 ndr1 0 r/w store the next output data for tpc output group 0
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 803 of 872 rej09b0325-0300 tcsr?timer control/status register h'a8 wdt bit initial value read/write 7 ovf 0 r/(w) 6 wt/ 0 r/w 5 tme 0 r/w 4 ? 1 ? 3 ? 1 ? 0 cks0 0 r/w 2 cks2 0 r/w 1 cks1 0 r/w overflow flag timer mode select it 0 [clearing condition] read ovf when ovf = 1, then write 0 in ovf 1 [setting condition] tcnt changes from h'ff to h'00 0 interval timer: requests interval timer interrupts 1 watchdog timer: generates a reset signal clock select 2 to 0 0 1 /2 /32 /64 /128 /256 /512 /2048 0 1 0 1 0 1 0 1 0 1 0 /4096 1 timer enable 0 timer disabled  1 timer enabled tcnt is initialized to h'00 and halted   tcnt is counting cpu interrupt requests are enabled note: * only 0 can be written, to clear the flag. *
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 804 of 872 rej09b0325-0300 tcnt?timer counter h'a9 (read), wdt h'a8 (write) bit initial value read/write 7 0 r/w 6 0 r/w 5 0 r/w 4 0 r/w 3 0 r/w 0 0 r/w 2 0 r/w 1 0 r/w count value rstcsr?reset control/status register h'ab (read), wdt h'aa (write) bit initial value read/write 7 wrst 0 r/(w) 6 rstoe 0 r/w 5 ? 1 ? 4 ? 1 ? 3 ? 1 ? 0 ? 1 ? 2 ? 1 ? 1 ? 1 ? reset output enable 0 external output of reset signal is disabled 1 external output of reset signal is enabled watchdog timer reset 0 [clearing conditions]  reset signal input at res pin  when wrst = 1, write 0 after reading wrst flag 1 [setting condition] tcnt overflow generates a reset signal note: * only 0 can be written in bit 7, to clear the flag. * h8/3048f-one not include this register h8/3048b mask rom version h8/3048f h8/3048ztat h8/3048 mask rom version h8/3047 mask rom version h8/3045 mask rom version h8/3044 mask rom version include this register
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 805 of 872 rej09b0325-0300 rstcsr?reset control/status register h'ab (read), wdt h'aa (write) bit initial value read/write 7 wrst 0 r/(w) 6 ? 0 ? 5 ? 1 ? 4 ? 1 ? 3 ? 1 ? 0 ? 1 ? 2 ? 1 ? 1 ? 1 ? watchdog timer reset 0 [clearing conditions]  reset signal input at res pin  when wrst = 1, write 0 after reading wrst flag 1 [setting condition] tcnt overflow generates a reset signal notes: 1. 2. only 0 can be written in bit 7, to clear the flag. bit 6 must not be set to 1; in a write, 0 must always be written in this bit. * 2 * 1 h8/3048f-one include this register h8/3048b mask rom version h8/3048f h8/3048ztat h8/3048 mask rom version h8/3047 mask rom version h8/3045 mask rom version h8/3044 mask rom version not include this register
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 806 of 872 rej09b0325-0300 rfshcr?refresh control register h'ac refresh controller bit initial value read/write 7 srfmd 0 r/w 6 psrame 0 r/w 5 drame 0 r/w 4 cas/ 0 r/w 3 m9/ m8 0 r/w 0 rcyce 0 r/w 2 rfshe 0 r/w 1 ? 1 ? self-refresh mode 0 dram or psram self-refresh is disabled in software standby mode 1 dram or psram self-refresh is enabled in software standby mode refresh cycle enable refresh pin enable psram enable, dram enable 0 refresh cycles are disabled 1 refresh cycles are enabled for area 3 address multiplex mode select 0 8-bit column mode 1 9-bit column mode we strobe mode select 0 1 0 2 mode 1 2 mode can be used as an interval timer (dram and psram cannot be directly connected) psram can be directly connected illegal setting bit 6 0 1 bit 5 0 0 1 ram interface psrame drame dram can be directly connected 1 refresh signal output at the pin is disabled refresh signal output at the pin is enabled rfsh rfsh we cas
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 807 of 872 rej09b0325-0300 rtmcsr?refresh timer control/status register h'ad refresh controller bit initial value read/write 7 cmf 0 r/(w) 6 cmie 0 r/w 5 cks2 0 r/w 4 cks1 0 r/w 3 cks0 0 r/w 0 ? 1 ? 2 ? 1 ? 1 ? 1 ? compare match flag compare match interrupt enable 0 [clearing condition] read cmf when cmf = 1, then write 0 in cmf 1 [setting condition] rtcnt = rtcor note: * only 0 can be written, to clear the flag. 0 the cmi interrupt requested by cmf is disabled 1 the cmi interrupt requested by cmf is enabled clock select 2 to 0 cks2 counter clock source cks1 bit 4 cks0 bit 3 bit 5 0 1 clock input is disabled /2 /8 /32 /128 /512 /2048 0 1 0 1 0 1 0 1 0 1 0 /4096 1 *
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 808 of 872 rej09b0325-0300 rtcnt?refresh timer counter h'ae refresh controller bit initial value read/write 7 0 r/w 6 0 r/w 5 0 r/w 4 0 r/w 3 0 r/w 0 0 r/w 2 0 r/w 1 0 r/w count value rtcor?refresh time constant register h'af refresh controller bit initial value read/write 7 1 r/w 6 1 r/w 5 1 r/w 4 1 r/w 3 1 r/w 0 1 r/w 2 1 r/w 1 1 r/w interval at which rtcnt and compare match are set
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 809 of 872 rej09b0325-0300 smr?serial mode register h'b0 sci0 bit initial value read/write 7 c/ a or gm * 0 r/w 6 chr 0 r/w 5 pe 0 r/w 3 stop 0 r/w 0 cks0 0 r/w 2 mp 0 r/w 1 cks1 0 r/w parity enable clock select 1 and 0 cks1 clock source cks0 bit 0 bit 1 0 1 clock /4 clock /16 clock /64 clock 0 0 1 1 7 o/ 0 r/w e 0 parity bit is not added or checked 1 parity bit is added and checked parity mode 0 even parity 1 odd parity stop bit length multiprocessor mode 0 multiprocessor function disabled 1 multiprocessor format selected 0 one stop bit 1 two stop bits character length 0 8-bit data 1 7-bit data communication mode (when using a serial communication interface) 0 asynchronous mode 1 synchronous mode gsm mode (when using a smart card interface) 0 regular smart card interface operation note: * the function of this bit differs for the normal serial communication interface and for the smart card interface. its function is switched with the smif bit in scmr. 1 gsm mode smart card interface operation
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 810 of 872 rej09b0325-0300 brr?bit rate register h'b1 sci0 bit initial value read/write 7 1 r/w 6 1 r/w 5 1 r/w 4 1 r/w 3 1 r/w 0 1 r/w 2 1 r/w 1 1 r/w serial communication bit rate setting
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 811 of 872 rej09b0325-0300 scr?serial control register h'b2 sci0 bit initial value read/write 7 tie 0 r/w 6 rie 0 r/w 5 te 0 r/w 4 re 0 r/w 3 mpie 0 r/w 0 cke0 0 r/w 2 teie 0 r/w 1 cke1 0 r/w transmit interrupt enable 0 transmit-data-empty interrupt request (txi) is disabled 1 transmit-data-empty interrupt request (txi) is enabled receive interrupt enable 0 receive-data-full (rxi) and receive-error (eri) interrupt requests are disabled 1 receive-data-full (rxi) and receive-error (eri) interrupt requests are enabled transmit enable clock enable 1 and 0 cke1 multiprocessor interrupt enable 0 1 clock selection and output asynchronous mode synchronous mode asynchronous mode synchronous mode asynchronous mode synchronous mode asynchronous mode bit 1 cke0 0 1 0 1 bit 0 receive enable synchronous mode 0 multiprocessor interrupts are disabled (normal receive operation) 1 multiprocessor interrupts are enabled 0 receiving is disabled 1 receiving is enabled transmit-end interrupt enable 0 transmitting is disabled 1 transmitting is enabled 0 transmit-end interrupt requests (tei) are disabled 1 transmit-end interrupt requests (tei) are enabled internal clock, sck pin available for generic i/o internal clock, sck pin used for serial clock output internal clock, sck pin used for clock output internal clock, sck pin used for serial clock output external clock, sck pin used for clock input external clock, sck pin used for serial clock input external clock, sck pin used for clock input external clock, sck pin used for serial clock input
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 812 of 872 rej09b0325-0300 tdr?transmit data register h'b3 sci0 bit initial value read/write 7 1 r/w 6 1 r/w 5 1 r/w 4 1 r/w 3 1 r/w 0 1 r/w 2 1 r/w 1 1 r/w serial transmit data
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 813 of 872 rej09b0325-0300 ssr?serial status register h'b4 sci0 bit initial value read/write 7 tdre 1 r/(w) 6 rdrf 0 r/(w) 5 orer 0 r/(w) 4 fer/ers 0 r/(w) 3 per 0 r/(w) 0 mpbt 0 r/w 2 tend 1 r 1 mpb 0 r ***** multiprocessor bit transfer transmit end 0 [clearing conditions] 1 [setting conditions] reset or transition to standby mode. te is cleared to 0 in scr and fer/ers is cleared to 0. tdre is 1 when last bit of 1-byte serial character is transmitted. read tdre when tdre = 1, then write 0 in tdre. the dmac writes data in tdr. multiprocessor bit parity error 0 [clearing conditions] 1 [setting condition] parity error: (parity of receive data does not match parity setting o/e bit in smr) reset or transition to standby mode. read per when per = 1, then write 0 in per. framing error (for sci0) 0 [clearing conditions] 1 [setting condition] framing error (stop bit is 0) reset or transition to standby mode. read fer when fer = 1, then write 0 in fer. error signal status (for smart card interface) 0 [clearing conditions] 1 [setting condition] a low error signal is received. reset or transition to standby mode. read ers when ers = 1, then write 0 in ers. overrun error 0 [clearing conditions] 1 [setting condition] overrun error (reception of next serial data ends when rdrf = 1) reset or transition to standby mode. read orer when orer = 1, then write 0 in orer. receive data register full 0 [clearing conditions] 1 [setting condition] serial data is received normally and transferred from rsr to rdr reset or transition to standby mode. read rdrf when rdrf = 1, then write 0 in rdrf. the dmac reads data from rdr. transmit data register empty 0 [clearing conditions] 1 [setting conditions] reset or transition to standby mode. te is 0 in scr data is transferred from tdr to tsr, enabling new data to be written in tdr. read tdre when tdre = 1, then write 0 in tdre. the dmac writes data in tdr. 0 multiprocessor bit value in receive data is 0 1 multiprocessor bit value in receive data is 1 0 multiprocessor bit value in transmit data is 0 1 multiprocessor bit value in transmit data is 1 note: * only 0 can be written, to clear the flag.
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 814 of 872 rej09b0325-0300 rdr?receive data register h'b5 sci0 bit initial value read/write 7 0 r 6 0 r 5 0 r 4 0 r 3 0 r 0 0 r 2 0 r 1 0 r serial receive data scmr?smart card mode register h'b6 sci0 bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 sdir 0 r/w 0 smif 0 r/w 2 sinv 0 r/w 1 ? 1 ? smart card interface mode select 0 smart card interface function is disabled (initial value) 1 smart card interface function is enabled smart card data invert 0 unmodified tdr contents are transmitted (initial value) received data is stored unmodified in rdr 1 inverted tdr contents are transmitted received data are inverted before storage in rdr smart card data transfer direction 0 tdr contents are transmitted lsb-first (initial value) received data is stored lsb-first in rdr 1 tdr contents are transmitted msb-first received data is stored msb-first in rdr
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 815 of 872 rej09b0325-0300 smr?serial mode register h'b8 sci1 bit initial value read/write 7 c/ 0 r/w 6 chr 0 r/w 5 pe 0 r/w 4 o/ 0 r/w 3 stop 0 r/w 0 cks0 0 r/w 2 mp 0 r/w 1 cks1 0 r/w note: bit functions are the same as for sci0. ae brr?bit rate register h'b9 sci1 bit initial value read/write 7 1 r/w 6 1 r/w 5 1 r/w 4 1 r/w 3 1 r/w 0 1 r/w 2 1 r/w 1 1 r/w note: bit functions are the same as for sci0. scr?serial control register h'ba sci1 bit initial value read/write 7 tie 0 r/w 6 rie 0 r/w 5 te 0 r/w 4 re 0 r/w 3 mpie 0 r/w 0 cke0 0 r/w 2 teie 0 r/w 1 cke1 0 r/w note: bit functions are the same as for sci0.
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 816 of 872 rej09b0325-0300 tdr?transmit data register h'bb sci1 bit initial value read/write 7 1 r/w 6 1 r/w 5 1 r/w 4 1 r/w 3 1 r/w 0 1 r/w 2 1 r/w 1 1 r/w note: bit functions are the same as for sci0. ssr?serial status register h'bc sci1 bit initial value read/write 7 tdre 1 r/(w) 6 rdrf 0 r/(w) 5 orer 0 r/(w) 4 fer 0 r/(w) 3 per 0 r/(w) 0 mpbt 0 r/w 2 tend 1 r 1 mpb 0 r ***** notes: bit functions are the same as for sci0. * only 0 can be written, to clear the flag. rdr?receive data register h'bd sci1 bit initial value read/write 7 0 r 6 0 r 5 0 r 4 0 r 3 0 r 0 0 r 2 0 r 1 0 r note: bit functions are the same as for sci0.
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 817 of 872 rej09b0325-0300 p1ddr?port 1 data direction register h'c0 port 1 bit modes 1 to 4 initial value read/write initial value read/write modes 5 to 7 7 p1 ddr 1 ? 0 w 7 6 p1 ddr 1 ? 0 w 6 5 p1 ddr 1 ? 0 w 5 4 p1 ddr 1 ? 0 w 4 3 p1 ddr 1 ? 0 w 3 2 p1 ddr 1 ? 0 w 2 1 p1 ddr 1 ? 0 w 1 0 p1 ddr 1 ? 0 w 0 port 1 input/output select 0 generic input pin 1 generic output pin p2ddr?port 2 data direction register h'c1 port 2 bit modes 1 to 4 initial value read/write initial value read/write modes 5 to 7 7 p2 ddr 1 ? 0 w 7 6 p2 ddr 1 ? 0 w 6 5 p2 ddr 1 ? 0 w 5 4 p2 ddr 1 ? 0 w 4 3 p2 ddr 1 ? 0 w 3 2 p2 ddr 1 ? 0 w 2 1 p2 ddr 1 ? 0 w 1 0 p2 ddr 1 ? 0 w 0 port 2 input/output select 0 generic input pin 1 generic output pin p1dr?port 1 data register h'c2 port 1 bit initial value read/write 7 p1 0 r/w 7 6 p1 0 r/w 6 5 p1 0 r/w 5 4 p1 0 r/w 4 3 p1 0 r/w 3 2 p1 0 r/w 2 1 p1 0 r/w 1 0 p1 0 r/w 0 data for port 1 pins
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 818 of 872 rej09b0325-0300 p2dr?port 2 data register h'c3 port 2 bit initial value read/write 7 p2 0 r/w 7 6 p2 0 r/w 6 5 p2 0 r/w 5 4 p2 0 r/w 4 3 p2 0 r/w 3 2 p2 0 r/w 2 1 p2 0 r/w 1 0 p2 0 r/w 0 data for port 2 pins p3ddr?port 3 data direction register h'c4 port 3 bit initial value read/write 7 p3 ddr 0 w 7 6 p3 ddr 0 w 6 5 p3 ddr 0 w 5 4 p3 ddr 0 w 4 3 p3 ddr 0 w 3 2 p3 ddr 0 w 2 1 p3 ddr 0 w 1 0 p3 ddr 0 w 0 port 3 input/output select 0 generic input pin 1 generic output pin p4ddr?port 4 data direction register h'c5 port 4 bit initial value read/write 7 p4 ddr 0 w 7 6 p4 ddr 0 w 6 5 p4 ddr 0 w 5 4 p4 ddr 0 w 4 3 p4 ddr 0 w 3 2 p4 ddr 0 w 2 1 p4 ddr 0 w 1 0 p4 ddr 0 w 0 port 4 input/output select 0 generic input pin 1 generic output pin
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 819 of 872 rej09b0325-0300 p3dr?port 3 data register h'c6 port 3 bit initial value read/write 7 p3 0 r/w 7 6 p3 0 r/w 6 5 p3 0 r/w 5 4 p3 0 r/w 4 3 p3 0 r/w 3 2 p3 0 r/w 2 1 p3 0 r/w 1 0 p3 0 r/w 0 data for port 3 pins p4dr?port 4 data register h'c7 port 4 bit initial value read/write 7 p4 0 r/w 7 6 p4 0 r/w 6 5 p4 0 r/w 5 4 p4 0 r/w 4 3 p4 0 r/w 3 2 p4 0 r/w 2 1 p4 0 r/w 1 0 p4 0 r/w 0 data for port 4 pins p5ddr?port 5 data direction register h'c8 port 5 bit modes 1 to 4 initial value read/write initial value read/write modes 5 to 7 7 ? 1 ? 1 ? 6 ? 1 ? 1 ? 5 ? 1 ? 1 ? 4 ? 1 ? 1 ? 3 p5 ddr 1 ? 0 w 3 2 p5 ddr 1 ? 0 w 2 1 p5 ddr 1 ? 0 w 1 0 p5 ddr 1 ? 0 w 0 port 5 input/output select 0 generic input 1 generic output
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 820 of 872 rej09b0325-0300 p6ddr?port 6 data direction register h'c9 port 6 bit initial value read/write 7 ? 1 ? 6 p6 ddr 0 w 6 5 p6 ddr 0 w 5 4 p6 ddr 0 w 4 3 p6 ddr 0 w 3 2 p6 ddr 0 w 2 1 p6 ddr 0 w 1 0 p6 ddr 0 w 0 port 6 input/output select 0 generic input 1 generic output p5dr?port 5 data register h'ca port 5 bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 p5 0 r/w 3 2 p5 0 r/w 2 1 p5 0 r/w 1 0 p5 0 r/w 0 data for port 5 pins p6dr?port 6 data register h'cb port 6 bit initial value read/write 7 ? 1 ? 6 p6 0 r/w 6 5 p6 0 r/w 5 4 p6 0 r/w 4 3 p6 0 r/w 3 2 p6 0 r/w 2 1 p6 0 r/w 1 0 p6 0 r/w 0 data for port 6 pins
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 821 of 872 rej09b0325-0300 p8ddr?port 8 data direction register h'cd port 8 bit modes 1 to 4 initial value read/write initial value read/write modes 5 to 7 7 ? 1 ? 1 ? 6 ? 1 ? 1 ? 5 ? 1 ? 1 ? 3 p8 ddr 0 w 0 w 3 2 p8 ddr 0 w 0 w 2 1 p8 ddr 0 w 0 w 1 0 p8 ddr 0 w 0 w 0 4 p8 ddr 1 w 0 w 4 port 8 input/output select port 8 input/output select 0 generic input 1 generic output 0 generic input 1 output cs p7dr?port 7 data register h'ce port 7 bit initial value read/write 0 p7 ? r * note: * determined by pins p7 to p7 . 0 1 p7 ? r * 1 2 p7 ? r * 2 3 p7 ? r * 3 4 p7 ? r * 4 5 p7 ? r * 5 6 p7 ? r * 6 7 p7 ? r * 7 read the pin levels for port 7 70 p8dr?port 8 data register h'cf port 8 bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 p8 0 r/w 4 3 p8 0 r/w 3 2 p8 0 r/w 2 1 p8 0 r/w 1 0 p8 0 r/w 0 data for port 8 pins
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 822 of 872 rej09b0325-0300 p9ddr?port 9 data direction register h'd0 port 9 bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 p9 ddr 0 w 5 4 p9 ddr 0 w 4 3 p9 ddr 0 w 3 2 p9 ddr 0 w 2 1 p9 ddr 0 w 1 0 p9 ddr 0 w 0 port 9 input/output select 0 generic input 1 generic output paddr?port a data direction register h'd1 port a bit modes 3, 4, 6 initial value read/write initial value read/write modes 1, 2, 5, 7 32 10 4 7 pa ddr 1 ? 0 w 7 6 pa ddr 0 w 0 w 6 5 pa ddr 0 w 0 w 5 4 pa ddr 0 w 0 w 4 3 pa ddr 0 w 0 w 3 2 pa ddr 0 w 0 w 2 1 pa ddr 0 w 0 w 1 0 pa ddr 0 w 0 w 0 port a input/output select 0 generic input 1 generic output p9dr?port 9 data register h'd2 port 9 bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 p9 0 r/w 4 p9 0 r/w 4 3 p9 0 r/w 3 2 p9 0 r/w 2 1 p9 0 r/w 1 0 p9 0 r/w 0 data for port 9 pins 5
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 823 of 872 rej09b0325-0300 padr?port a data register h'd3 port a bit initial value read/write 0 pa 0 r/w 0 1 pa 0 r/w 1 2 pa 0 r/w 2 3 pa 0 r/w 3 4 pa 0 r/w 4 5 pa 0 r/w 5 6 pa 0 r/w 6 7 pa 0 r/w 7 data for port a pins pbddr?port b data direction register h'd4 port b bit initial value read/write 7 pb ddr 0 w 7 6 pb ddr 0 w 6 5 pb ddr 0 w 5 4 pb ddr 0 w 4 3 pb ddr 0 w 3 2 pb ddr 0 w 2 1 pb ddr 0 w 1 0 pb ddr 0 w 0 port b input/output select 0 generic input 1 generic output pbdr?port b data register h'd6 port b bit initial value read/write 0 pb 0 r/w 0 1 pb 0 r/w 1 2 pb 0 r/w 2 3 pb 0 r/w 3 4 pb 0 r/w 4 5 pb 0 r/w 5 6 pb 0 r/w 6 7 pb 0 r/w 7 data for port b pins
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 824 of 872 rej09b0325-0300 p2pcr?port 2 input pull-up mos control register h'd8 port 2 bit initial value read/write 7 p2 pcr 0 r/w 7 6 p2 pcr 0 r/w 6 5 p2 pcr 0 r/w 5 4 p2 pcr 0 r/w 4 3 p2 pcr 0 r/w 3 2 p2 pcr 0 r/w 2 1 p2 pcr 0 r/w 1 0 p2 pcr 0 r/w 0 port 2 input pull-up mos control 7 to 0 0 input pull-up transistor is off 1 input pull-up transistor is on note: valid when the corresponding p2ddr bit is cleared to 0 (designating generic input). p4pcr?port 4 input pull-up mos control register h'da port 4 bit initial value read/write 7 p4 pcr 0 r/w 7 6 p4 pcr 0 r/w 6 5 p4 pcr 0 r/w 5 4 p4 pcr 0 r/w 4 3 p4 pcr 0 r/w 3 2 p4 pcr 0 r/w 2 1 p4 pcr 0 r/w 1 0 p4 pcr 0 r/w 0 port 4 input pull-up mos control 7 to 0 0 input pull-up transistor is off 1 input pull-up transistor is on note: valid when the corresponding p4ddr bit is cleared to 0 (designating generic input).
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 825 of 872 rej09b0325-0300 p5pcr?port 5 input pull-up mos control register h'db port 5 bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 p5 pcr 0 r/w 3 2 p5 pcr 0 r/w 2 1 p5 pcr 0 r/w 1 0 p5 pcr 0 r/w 0 port 5 input pull-up mos control 3 to 0 0 input pull-up transistor is off 1 input pull-up transistor is on note: valid when the corresponding p5ddr bit is cleared to 0 (designating generic input). dadr0?d/a data register 0 h'dc d/a bit initial value read/write 7 0 r/w 6 0 r/w 5 0 r/w 4 0 r/w 3 0 r/w 0 0 r/w 2 0 r/w 1 0 r/w d/a conversion data dadr1?d/a data register 1 h'dd d/a bit initial value read/write 7 0 r/w 6 0 r/w 5 0 r/w 4 0 r/w 3 0 r/w 0 0 r/w 2 0 r/w 1 0 r/w d/a conversion data
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 826 of 872 rej09b0325-0300 dacr?d/a control register h'de d/a bit initial value read/write 7 daoe1 0 r/w 6 daoe0 0 r/w 5 dae 0 r/w 4 ? 1 ? 3 ? 1 ? 0 ? 1 ? 2 ? 1 ? 1 ? 1 ? d/a output enable 1 0da 1 analog output is disabled 1 channel-1 d/a conversion and da 1 analog output are enabled d/a output enable 0 0da 0 analog output is disabled 1 channel-0 d/a conversion and da 0 analog output are enabled d/a enable daoe1 0 1 description d/a conversion is disabled in channels 0 and 1 d/a conversion is disabled in channel 0 d/a conversion is enabled in channel 1 d/a conversion is enabled in channels 0 and 1 d/a conversion is enabled in channels 0 and 1 bit 7 daoe0 0 0 1 bit 6 dae ? 0 1 bit 5 d/a conversion is enabled in channel 0 d/a conversion is disabled in channel 1 1 0 d/a conversion is enabled in channels 0 and 1 1 ? addra h/l?a/d data register a h/l h'e0, h'e1 a/d bit initial value read/write 14 ad8 0 r 12 ad6 0 r 10 ad4 0 r 8 ad2 0 r 6 ad0 0 r 0 ? 0 r 4 ? 0 r 2 ? 0 r 15 ad9 0 r 13 ad7 0 r 11 ad5 0 r 9 ad3 0 r 7 ad1 0 r 1 ? 0 r 5 ? 0 r 3 ? 0 r a/d conversion data 10-bit data giving an a/d conversion result addrah addral
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 827 of 872 rej09b0325-0300 addrb h/l?a/d data register b h/l h'e2, h'e3 a/d bit initial value read/write 14 ad8 0 r 12 ad6 0 r 10 ad4 0 r 8 ad2 0 r 6 ad0 0 r 0 ? 0 r 4 ? 0 r 2 ? 0 r 15 ad9 0 r 13 ad7 0 r 11 ad5 0 r 9 ad3 0 r 7 ad1 0 r 1 ? 0 r 5 ? 0 r 3 ? 0 r addrbh addrbl a/d conversion data 10-bit data giving an a/d conversion result addrc h/l?a/d data register c h/l h'e4, h'e5 a/d bit initial value read/write 14 ad8 0 r 12 ad6 0 r 10 ad4 0 r 8 ad2 0 r 6 ad0 0 r 0 ? 0 r 4 ? 0 r 2 ? 0 r 15 ad9 0 r 13 ad7 0 r 11 ad5 0 r 9 ad3 0 r 7 ad1 0 r 1 ? 0 r 5 ? 0 r 3 ? 0 r addrch addrcl a/d conversion data 10-bit data giving an a/d conversion result addrd h/l?a/d data register d h/l h'e6, h'e7 a/d bit initial value read/write 14 ad8 0 r 12 ad6 0 r 10 ad4 0 r 8 ad2 0 r 6 ad0 0 r 0 ? 0 r 4 ? 0 r 2 ? 0 r 15 ad9 0 r 13 ad7 0 r 11 ad5 0 r 9 ad3 0 r 7 ad1 0 r 1 ? 0 r 5 ? 0 r 3 ? 0 r addrdh addrdl a/d conversion data 10-bit data giving an a/d conversion result
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 828 of 872 rej09b0325-0300 adcsr?a/d control/status register h'e8 a/d bit initial value read/write 7 adf 0 r/(w) 6 adie 0 r/w 5 adst 0 r/w 4 scan 0 r/w 3 cks 0 r/w 0 ch0 0 r/w 2 ch2 0 r/w 1 ch1 0 r/w * note: * only 0 can be written, to clear flag. channel select 2 to 0 ch2 1 single mode an an an an an an an ch1 0 1 0 1 channel selection ch0 0 1 0 1 0 1 0 1 0 0 1 2 3 4 5 6 an 7 scan mode an an , an an to an an to an an an , an an to an 0 0 0 0 4 4 4 an to an 4 1 5 2 3 6 7 description group selection a/d end flag a/d interrupt enable a/d start clock select scan mode 0 [clearing condition] read adf while adf = 1, then write 0 in adf 1 [setting conditions] single mode: scan mode: 0 a/d end interrupt request is disabled 1 a/d end interrupt request is enabled 0 a/d conversion is stopped 1 single mode: scan mode: 0 single mode 1 scan mode 0 conversion time = 266 states (maximum) 1 conversion time = 134 states (maximum) a/d conversion ends a/d conversion ends in all selected channels a/d conversion starts; adst is automatically cleared to 0 when conversion ends a/d conversion starts and continues, cycling among the selected channels, until adst is cleared to 0 by software, by a reset, or by a transition to standby mode
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 829 of 872 rej09b0325-0300 adcr?a/d control register h'e9 a/d bit initial value read/write 7 trge 0 r/w 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 ? 1 ? 0 ? 1 ? 2 ? 1 ? 1 ? 1 ? trigger enable 0 a/d conversion cannot be externally triggered 1 a/d conversion starts at the fall of the external trigger signal ( ) adtrg h8/3048f-one not include this register h8/3048f h8/3048b mask rom version h8/3048ztat h8/3048 mask rom version h8/3047 mask rom version h8/3045 mask rom version h8/3044 mask rom version include this register adcr?a/d control register h'e9 a/d bit initial value read/write 7 trge 0 r/w 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 ? 1 ? 0 ? 0 ? * 2 ? 1 ? 1 ? 1 ? trigger enable 0 a/d conversion cannot be externally triggered 1 a/d conversion starts at the fall of the external trigger signal ( ) adtrg h8/3048f-one include this register h8/3048f h8/3048b mask rom version h8/3048ztat h8/3048 mask rom version h8/3047 mask rom version h8/3045 mask rom version h8/3044 mask rom version not include this register note: * bit 0 must not be set to 1; in a write, 0 must always be written in this bit.
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 830 of 872 rej09b0325-0300 abwcr?bus width control register h'ec bus controller bit read/write 7 abw7 1 0 r/w 6 abw6 1 0 r/w 5 abw5 1 0 r/w 4 abw4 1 0 r/w 3 abw3 1 0 r/w 0 abw0 1 0 r/w 2 abw2 1 0 r/w 1 abw1 1 0 r/w initial value m o d e 1, 3, 5, 6 m o d e 2, 4, 7 area 7 to 0 bus width control areas 7 to 0 are 16-bit access areas areas 7 to 0 are 8-bit access areas bits 7 to 0 0 1 bus width of access area abw7 to abw0 astcr?access state control register h'ed bus controller bit initial value read/write 7 ast7 1 r/w 6 ast6 1 r/w 5 ast5 1 r/w 4 ast4 1 r/w 3 ast3 1 r/w 0 ast0 1 r/w 2 ast2 1 r/w 1 ast1 1 r/w area 7 to 0 access state control areas 7 to 0 are two-state access areas areas 7 to 0 are three-state access areas bits 7 to 0 0 1 number of states in access cycle ast7 to ast0
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 831 of 872 rej09b0325-0300 wcr?wait control register h'ee bus controller bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 wms1 0 r/w 0 wc0 1 r/w 2 wms0 0 r/w 1 wc1 1 r/w wait count 1 and 0 wc1 number of wait states wc0 bit 0 bit 1 0 1 no wait states inserted by wait-state controller 1 state inserted 2 states inserted 3 states inserted 0 0 1 1 wait mode select 1 and 0 wms1 wait mode wms0 bit 2 bit 3 0 1 programmable wait mode no wait states inserted by wait-state controller pin wait mode 1 pin auto-wait mode 0 0 1 1 wcer?wait-state controller enable register h'ef bus controller bit initial value read/write 7 wce7 1 r/w 6 wce6 1 r/w 5 wce5 1 r/w 4 wce4 1 r/w 3 wce3 1 r/w 0 wce0 1 r/w 2 wce2 1 r/w 1 wce1 1 r/w wait-state controller enable 7 to 0 0 wait-state control is disabled (pin wait mode 0) 1 wait-state control is enabled
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 832 of 872 rej09b0325-0300 mdcr?mode control register h'f1 system control bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 0 ? 4 ? 0 ? 3 ? 0 ? 0 mds0 ? r * 2 mds2 ? r 1 mds1 ? r ** note: * determined by the state of the mode pins (md 2 to md 0 ). mode select 2 to 0 md 2 0 operating mode ? mode 1 mode 2 mode 3 bit 2 md 1 0 1 bit 1 md 0 0 1 0 1 bit 0 1 mode 4 mode 5 mode 6 mode 7 0 1 0 1 0 1
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 833 of 872 rej09b0325-0300 syscr?system control register h'f2 system control bit initial value read/write 7 ssby 0 r/w 6 sts2 0 r/w 5 sts1 0 r/w 4 sts0 0 r/w 3 ue 1 r/w 0 rame 1 r/w 2 nmieg 0 r/w 1 ? 1 ? software standby 0 sleep instruction causes transition to sleep mode 1 sleep instruction causes transition to software standby mode standby timer select 2 to 0 sts2 0 1 h8/3048f-one h8/3048b mask rom version standby timer waiting time = 8,192 states waiting time = 16,384 states waiting time = 32,768 states waiting time = 65,536 states waiting time = 131,072 states waiting time = 262,144 states bit 6 note: * h8/3048f h8/3048ztat h8/3048 mask rom version h8/3047 mask rom version h8/3045 mask rom version h8/3044 mask rom version sts1 0 1 0 bit 5 sts0 0 1 0 1 1 waiting time = 1,024 states 10 illegal setting * waiting time = 8,192 states waiting time = 16,384 states waiting time = 32,768 states waiting time = 65,536 states waiting time = 131,072 states waiting time = 1,024 states illegal setting illegal setting 1 bit 4 ram enable 0 on-chip ram is disabled 1 on-chip ram is enabled nmi edge select 0 an interrupt is requested at the falling edge of nmi 1 an interrupt is requested at the rising edge of nmi user bit enable 0 ccr bit 6 (ui) is used as an interrupt mask bit 1 ccr bit 6 (ui) is used as a user bit 0
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 834 of 872 rej09b0325-0300 brcr?bus release control register h'f3 bus controller bit modes 1, 2, 5, 7 initial value read/write initial value read/write modes 3, 4, 6 7 a23e 1 ? 1 r/w 6 a22e 1 ? 1 r/w 5 a21e 1 ? 1 r/w 3 ? 1 ? 1 ? 2 ? 1 ? 1 ? 1 ? 1 ? 1 ? 0 brle 0 r/w 0 r/w 4 ? 1 ? 1 ? bus release enable address 23 to 21 enable 0 the bus cannot be released to an external device 1 the bus can be released to an external device 0 address output 1 other input/output iscr?irq sense control register h'f4 interrupt controller bit initial value read/write 7 ? 0 r/w 6 ? 0 r/w 5 irq5sc 0 r/w 4 irq4sc 0 r/w 3 irq3sc 0 r/w 2 irq2sc 0 r/w 1 irq1sc 0 r/w 0 irq0sc 0 r/w irq to irq sense control 0 interrupts are requested when irq to irq inputs are low 1 interrupts are requested by falling-edge input at irq to irq 50 5 5 0 0
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 835 of 872 rej09b0325-0300 ier?irq enable register h'f5 interrupt controller bit initial value read/write 7 ? 0 r/w 6 ? 0 r/w 5 irq5e 0 r/w 4 irq4e 0 r/w 3 irq3e 0 r/w 2 irq2e 0 r/w 1 irq1e 0 r/w 0 irq0e 0 r/w irq to irq enable 0 irq to irq interrupts are disabled 1 irq to irq interrupts are enabled 50 5 5 0 0 isr?irq status register h'f6 interrupt controller bit initial value read/write 7 ? 0 ? 6 ? 0 ? 5 irq5f 0 r/(w) * 4 irq4f 0 r/(w) * 3 irq3f 0 r/(w) * 2 irq2f 0 r/(w) * 1 irq1f 0 r/(w) * 0 irq0f 0 r/(w) * irq to irq flags bits 5 to 0 0 1 setting and clearing conditions irq5f to irq0f [clearing conditions] read irqnf when irqnf = 1, then write 0 in irqnf. irqnsc = 0, input is high, and interrupt exception handling is carried out. irqnsc = 1 and irqn interrupt exception handling is carried out. [setting conditions] irqnsc = 0 and irqn input is low. irqnsc = 1 and a falling edge is generated in the irqn input. (n = 5 to 0) irqn 50 note: * only 0 can be written, to clear the flag.
appendix b internal i/o register rev. 3.00 sep 27, 2006 page 836 of 872 rej09b0325-0300 ipra?interrupt priority register a h'f8 interrupt controller bit initial value read/write 7 ipra7 0 r/w 6 ipra6 0 r/w 5 ipra5 0 r/w 4 ipra4 0 r/w 3 ipra3 0 r/w 0 ipra0 0 r/w 2 ipra2 0 r/w 1 ipra1 0 r/w priority level a7 to a0 0 priority level 0 (low priority) 1 priority level 1 (high priority) ? interrupt sources controlled by each bit bit 7: ipra7 bit 6: ipra6 bit 5: ipra5 bit 4: ipra4 bit 3: ipra3 bit 2: ipra2 bit 1: ipra1 bit 0: ipra0 interrupt source irq 0 irq 1 irq 2 , irq 3 irq 4 , irq 5 wdt, refresh controller itu channel 0 itu channel 1 itu channel 2 iprb?interrupt priority register b h'f9 interrupt controller bit initial value read/write 7 iprb7 0 r/w 6 iprb6 0 r/w 5 iprb5 0 r/w 4 ? 0 r/w 3 iprb3 0 r/w 0 ? 0 r/w 2 iprb2 0 r/w 1 iprb1 0 r/w priority level b7 to b5, b3 to b 1 0 priority level 0 (low priority) 1 priority level 1 (high priority) ? interrupt sources controlled by each bit bit 7: iprb7 bit 6: iprb6 bit 5: iprb5 bit 4: ? bit 3: iprb3 bit 2: iprb2 bit 1: iprb1 bit 0: ? interrupt source itu channel 3 itu channel 4 dmac ? sci channel 0 sci channel 1 a/d converter ?
appendix c i/o port block diagrams rev. 3.00 sep 27, 2006 page 837 of 872 rej09b0325-0300 appendix c i/o port block diagrams c.1 port 1 block diagram reset r p1 ddr n mode 1 to 4 wp1d q d c reset r p1 dr n wp1 qd c rp1 mode 7 mode 1 to 6 internal data bus (upper) internal address bus wp1d: wp1: rp1: note: n = 0 to 7 legend: write to p1ddr write to port 1 read port 1 p1 n external bus released hardware standby software standby mode 7 figure c.1 port 1 block diagram (pins p1 0 to p1 7 )
appendix c i/o port block diagrams rev. 3.00 sep 27, 2006 page 838 of 872 rej09b0325-0300 c.2 port 2 block diagram reset r p2 dr n wp2 qd c reset r p2 ddr n wp2d qd c reset r p2 pcr n wp2p qd c mode 7 mode 1 to 6 internal data bus (upper) internal address bus p2 n rp2p rp2 wp2p: rp2p: wp2d: wp2: rp2: legend: write to p2pcr read p2pcr write to p2ddr write to port 2 read port 2 external bus released hardware standby software standby mode 7 mode 1 to 4 note: n = 0 to 7 figure c.2 port 2 block diagram (pins p2 0 to p2 7 )
appendix c i/o port block diagrams rev. 3.00 sep 27, 2006 page 839 of 872 rej09b0325-0300 c.3 port 3 block diagram p3 n reset r p3 ddr n wp3d qd c reset r p3 dr n wp3 qd c rp3 mode 1 to 6 internal data bus (upper) wp3d: wp3: rp3: note: n = 0 to 7 legend: write to p3ddr write to port 3 read port 3 mode 7 write to external address mode 7 hardware standby external bus released read external address internal data bus (lower) figure c.3 port 3 block diagram (pins p3 0 to p3 7 )
appendix c i/o port block diagrams rev. 3.00 sep 27, 2006 page 840 of 872 rej09b0325-0300 c.4 port 4 block diagram p4 n rp4p rp4 wp4 wp4d wp4p reset reset reset qd r c p4 pcr n qd r c p4 ddr n qd r c p4 dr n wp4p: rp4p: wp4d: wp4: rp4: legend: write to p4pcr read p4pcr write to p4ddr write to port 4 read port 4 write to external address read external address internal data bus (upper) internal data bus (lower) 8-bit bus mode mode 7 mode 1 to 6 16-bit bus mode note: n = 0 to 7 figure c.4 port 4 block diagram (pins p4 0 to p4 7 )
appendix c i/o port block diagrams rev. 3.00 sep 27, 2006 page 841 of 872 rej09b0325-0300 c.5 port 5 block diagram p5 n rp5p rp5 wp5 wp5d wp5p reset reset reset qd r c p5 pcr n qd r c p5 ddr n qd r c p5 dr n wp5p: rp5p: wp5d: wp5: rp5: note: n = 0 to 3 legend: write to p5pcr read p5pcr write to p5ddr write to port 5 read port 5 mode 7 mode 1 to 6 internal data bus (upper) internal address bus external bus released hardware standby software standby mode 7 mode 1 to 4 figure c.5 port 5 block diagram (pins p5 0 to p5 3 )
appendix c i/o port block diagrams rev. 3.00 sep 27, 2006 page 842 of 872 rej09b0325-0300 c.6 port 6 block diagrams wp6d: wp6: rp6: legend: write to p6ddr write to port 6 read port 6 rp6 input wp6d reset qd r c p6 ddr 0 wp6 reset qd r c p6 dr 0 p6 0 internal data bus bus controller wait input enable bus controller wait mode 7 figure c.6 (a) port 6 block diagram (pin p6 0 )
appendix c i/o port block diagrams rev. 3.00 sep 27, 2006 page 843 of 872 rej09b0325-0300 p6 1 wp6d: wp6: rp6: legend: write to p6ddr write to port 6 read port 6 wp6d reset qd r c p6 ddr 1 wp6 reset qd r c p6 dr 1 rp6 internal data bus bus controller bus release enable breq input mode 7 figure c.6 (b) port 6 block diagram (pin p6 1 )
appendix c i/o port block diagrams rev. 3.00 sep 27, 2006 page 844 of 872 rej09b0325-0300 wp6d reset qd r c p6 ddr 2 wp6 reset qd r c p6 dr 2 rp6 p6 2 wp6d: wp6: rp6: legend: write to p6ddr write to port 6 read port 6 internal data bus bus controller bus release enable back output mode 7 figure c.6 (c) port 6 block diagram (pin p6 2 )
appendix c i/o port block diagrams rev. 3.00 sep 27, 2006 page 845 of 872 rej09b0325-0300 p6 n reset r p6 ddr n wp6d qd c reset r p6 dr n wp6 qd c rp6 mode 1 to 6 internal data bus wp6d: wp6: rp6: note: n = 6 to 3 legend: write to p6ddr write to port 6 read port 6 mode 7 as output rd output hwr output lwr output external bus released hardware standby software standby mode 7 mode 7 figure c.6 (d) port 6 block diagram (pins p6 6 to p6 3 )
appendix c i/o port block diagrams rev. 3.00 sep 27, 2006 page 846 of 872 rej09b0325-0300 c.7 port 7 block diagrams p7 n rp7 rp7: read port 7 note: n = 0 to 5 legend: internal data bus a/d converter analog input input enable figure c.7 (a) port 7 block diagram (pins p7 0 to p7 5 ) p7 n rp7 rp7: read port 7 note: n = 6 and 7 legend: internal data bus a/d converter analog input d/a converter analog output output enable input enable figure c.7 (b) port 7 block diagram (pins p7 6 and p7 7 )
appendix c i/o port block diagrams rev. 3.00 sep 27, 2006 page 847 of 872 rej09b0325-0300 c.8 port 8 block diagrams p8 0 rp8 wp8d reset qd r c p8 ddr 0 wp8 reset qd r c p8 dr 0 wp8d: wp8: rp8: legend: write to p8ddr write to port 8 read port 8 internal data bus refresh controller output enable output interrupt controller input rfsh irq 0 mode 7 figure c.8 (a) port 8 block diagram (pin p8 0 )
appendix c i/o port block diagrams rev. 3.00 sep 27, 2006 page 848 of 872 rej09b0325-0300 p8 n wp8d reset qd r c p8 ddr n wp8 reset qd r c p8 dr n rp8 wp8d wp8: rp8: note: n = 1 to 3 legend: write to p8ddr write to port 8 read port 8 internal data bus bus controller output interrupt controller irq irq irq cs cs cs 1 2 3 1 2 3 input mode 7 mode 1 to 6 figure c.8 (b) port 8 block diagram (pins p8 1 to p8 3 )
appendix c i/o port block diagrams rev. 3.00 sep 27, 2006 page 849 of 872 rej09b0325-0300 p8 4 wp8d qd s c p8 ddr 4 wp8 reset reset mode 1 to 4 qd r c p8 dr 4 rp8 wp8d: wp8: rp8: legend: write to p8ddr write to port 8 read port 8 internal data bus bus controller output 0 cs mode 7 mode 1 to 6 r figure c.8 (c) port 8 block diagram (pin p8 4 )
appendix c i/o port block diagrams rev. 3.00 sep 27, 2006 page 850 of 872 rej09b0325-0300 c.9 port 9 block diagrams wp9d: wp9: rp9: legend: write to p9ddr write to port 9 read port 9 p9 0 rp9 wp9d reset qd r c p9 ddr 0 wp9 reset qd r c p9 dr 0 internal data bus sci0 output enable serial transmit data guard time figure c.9 (a) port 9 block diagram (pin p9 0 )
appendix c i/o port block diagrams rev. 3.00 sep 27, 2006 page 851 of 872 rej09b0325-0300 wp9d: wp9: rp9: legend: write to p9ddr write to port 9 read port 9 p9 1 rp9 wp9d reset qd r c p9 ddr 1 wp9 reset qd r c p9 dr 1 internal data bus sci1 output enable serial transmit data figure c.9 (b) port 9 block diagram (pin p9 1 )
appendix c i/o port block diagrams rev. 3.00 sep 27, 2006 page 852 of 872 rej09b0325-0300 wp9d: wp9: rp9: note: n = 2 and 3 legend: write to p9ddr write to port 9 read port 9 p9 n wp9d reset qd r c p9 ddr n wp9 reset qd r c p9 dr n rp9 internal data bus input enable serial receive data sci figure c.9 (c) port 9 block diagram (pins p9 2 and p9 3 )
appendix c i/o port block diagrams rev. 3.00 sep 27, 2006 page 853 of 872 rej09b0325-0300 wp9d: wp9: rp9: note: n = 4 and 5 legend: write to p9ddr write to port 9 read port 9 wp9d reset qd r c p9 ddr n wp9 reset qd r c p9 dr n rp9 p9 n internal data bus sci clock input enable clock output enable clock output clock input interrupt controller or input irq 4 irq 5 figure c.9 (d) port 9 block diagram (pins p9 4 and p9 5 )
appendix c i/o port block diagrams rev. 3.00 sep 27, 2006 page 854 of 872 rej09b0325-0300 c.10 port a block diagrams wpad: wpa: rpa: note: n = 0 and 1 legend: write to paddr write to port a read port a pa n wpad reset qd r c pa ddr n reset qd r c pa dr n rpa wpa internal data bus tpc output enable tpc next data output trigger output enable transfer end output dma controller counter clock input itu figure c.10 (a) port a block diagram (pins pa 0 and pa 1 )
appendix c i/o port block diagrams rev. 3.00 sep 27, 2006 page 855 of 872 rej09b0325-0300 wpad: wpa: rpa: note: n = 2 and 3 legend: write to paddr write to port a read port a pa n rpa wpa wpad reset qd r c pa ddr n reset qd r c pa dr n internal data bus tpc output enable tpc next data output trigger output enable compare match output input capture counter clock input itu figure c.10 (b) port a block diagram (pins pa 2 and pa 3 )
appendix c i/o port block diagrams rev. 3.00 sep 27, 2006 page 856 of 872 rej09b0325-0300 wpad: wpa: rpa: note: n = 4 to 6 legend: write to paddr write to port a read port a pa n wpad hardware standby software standby external bus released reset pra wpa qd r c pa n ddr reset qd r c pa n dr internal address bus internal data bus bus controller tpc itu chip select enable tpc output enable next data output trigger output enable compare match output input capture address output enable cs 4 cs 5 cs 6 output figure c.10 (c) port a block diagram (pins pa 4 to pa 6 )
appendix c i/o port block diagrams rev. 3.00 sep 27, 2006 page 857 of 872 rej09b0325-0300 wpad: wpa: rpa: legend: write to paddr write to port a read port a pa 7 wpad hardware standby software standby external bus released reset pra wpa qd r c pa 7 ddr reset qd r c pa 7 dr internal address bus internal data bus bus controller tpc itu tpc output enable next data output trigger output enable compare match output input capture address output enable figure c.10 (d) port a block diagram (pin pa 7 )
appendix c i/o port block diagrams rev. 3.00 sep 27, 2006 page 858 of 872 rej09b0325-0300 c.11 port b block diagrams pb n wpbd: wpb: rpb: note: n = 0 to 3 legend: write to pbddr write to port b read port b reset qd r c pb ddr n wpbd reset qd r c pb dr n wpb rpb internal data bus tpc output enable tpc next data output trigger output enable compare match output input capture itu figure c.11 (a) port b block diagram (pins pb 0 to pb 3 )
appendix c i/o port block diagrams rev. 3.00 sep 27, 2006 page 859 of 872 rej09b0325-0300 pb n wpbd: wpb: rpb: note: n = 4 and 5 legend: write to pbddr write to port b read port b wpb rpb reset qd r c pb ddr n wpbd reset qd r c pb dr n internal data bus tpc output enable next data output trigger output enable compare match output tpc itu figure c.11 (b) port b block diagram (pins pb 4 and pb 5 )
appendix c i/o port block diagrams rev. 3.00 sep 27, 2006 page 860 of 872 rej09b0325-0300 wpbd reset reset qd r c pb ddr qd r c pb dr 6 rpb wpb dmac dreq0 input tpc bus controller wpbd: wpb: rpb: legend: write to pbddr write to port b read port b tpc output enable next data output trigger chip select enable cs 7 output internal data bus 6 pb 6 figure c.11 (c) port b block diagram (pin pb 6 )
appendix c i/o port block diagrams rev. 3.00 sep 27, 2006 page 861 of 872 rej09b0325-0300 pb 7 wpbd reset reset qd r c pb ddr qd r c pb dr 7 rpb wpb dmac tpc wpbd: wpb: rpb: legend: write to pbddr write to port b read port b tpc output enable next data output trigger internal data bus 7 adtrg input a/d converter dreq1 input figure c.11 (d) port b block diagram (pin pb 7 )
appendix d pin states rev. 3.00 sep 27, 2006 page 862 of 872 rej09b0325-0300 appendix d pin states d.1 port states in each mode table d.1 port states pin name mode reset hardware standby mode software standby mode bus- released mode program execution, sleep mode ? clock output t h clock output clock output reso * 2 ?t * 2 tt t reso p1 7 to p1 0 1 to 4 l t t t a 7 to a 0 5, 6 t t keep t input port (ddr = 0) tta 7 to a 0 (ddr = 1) 7 t t keep ? i/o port p2 7 to p2 0 1 to 4 l t t t a 15 to a 8 5, 6 t t keep t input port (ddr = 0) tta 15 to a 8 (ddr = 1) 7 t t keep ? i/o port p3 7 to p3 0 1 to 6 t t t t d 15 to d 8 7 t t keep ? i/o port p4 7 to p4 0 1 to 6 8-bit bus t t keep keep i/o port 16-bit bus ttttd 7 to d 0 7 t t keep ? i/o port p5 3 to p5 0 1 to 4 l t t t a 19 to a 16 5, 6 t t keep t input port (ddr = 0) tta 19 to a 16 (ddr = 1) 7 t t keep ? i/o port
appendix d pin states rev. 3.00 sep 27, 2006 page 863 of 872 rej09b0325-0300 pin name mode reset hardware standby mode software standby mode bus- released mode program execution, sleep mode p6 0 1 to 6 t t keep keep i/o port wait 7 t t keep ? i/o port p6 1 1 to 6 t t keep (brle = 0) t (brle = 1) t i/o port breq 7 t t keep ? i/o port p6 2 1 to 6 t t keep (brle = 0) h (brle = 1) l i/o port (brle = 0) or back (brle = 1) 7 t t keep ? i/o port p6 6 to p6 3 1 to 6 h * 3 tt t as , rd , hwr , lwr 7 t t keep ? i/o port p7 7 to p7 0 1 to 7 t t t t * 1 input port p8 0 1 to 6 t t keep (rfshe = 0) rfsh (rfshe = 1) keep (rfshe = 0) h (rfshe = 1) i/o port (rfshe = 0) or rfsh (rfshe = 1) 7 t t keep ? i/o port p8 3 to p8 1 1 to 6 t t t (ddr = 0) h (ddr = 1) keep (ddr = 0) h (ddr = 1) input port (ddr = 0) or cs 3 to cs 1 (ddr = 1) 7 t t keep ? i/o port p8 4 1 to 6 l t t (ddr = 0) l (ddr = 1) keep (ddr = 0) h (ddr = 1) input port (ddr = 0) or cs 0 (ddr = 1) 7 t t keep ? i/o port
appendix d pin states rev. 3.00 sep 27, 2006 page 864 of 872 rej09b0325-0300 pin name mode reset hardware standby mode software standby mode bus- released mode program execution, sleep mode p9 5 to p9 0 1 to 7 t t keep keep * 1 i/o port pa 3 to pa 0 1 to 7 t t keep keep * 1 i/o port pa 6 to pa 4 3, 4, 6 t * 4 th ( cs output) t (address output) keep (otherwise) h ( cs output) t (address output) keep (otherwise) cs 6 to cs 4 ( cs output) a 23 to a 21 (address output) i/o port (otherwise) 1, 2, 5, 7 t * 4 t keep keep * 1 i/o port pa 7 3, 4, 6 l * 4 ttta 20 1, 2, 5, 7 t * 4 t keep keep * 1 i/o port pb 7 , pb 5 to pb 0 1 to 7 t t keep keep * 1 i/o port pb 6 3, 4, 6 t t h ( cs output) keep (otherwise) h ( cs output) keep (otherwise) cs 7 ( cs output) i/o port (otherwise) 1, 2, 5, 7 t t keep keep * 1 i/o port legend: h: high l: low t: high-impedance state keep: input pins are in the high-impedance state; output pins maintain their previous state. ddr: data direction register bit notes: 1. the bus cannot be released in mode 7. 2. output is low only for reset by wdt overflow. this reso output function is only for the mask rom, ztat, and flash memory (dual power supply). 3. during direct power supply, oscillation damping time is ?h? or ?t?. 4. during direct power supply, oscillation damping time differs between ?h?, ?l? and ?t?.
appendix d pin states rev. 3.00 sep 27, 2006 page 865 of 872 rej09b0325-0300 d.2 pin states at reset reset in t1 state figure d.1 is a timing diagram for the case in which res goes low during the t1 state of an external memory access cycle. as soon as res goes low, all ports are initialized to the input state. as , rd , hwr , and lwr go high, and the data bus goes to the high-impedance state. the address bus is initialized to the low output level 0.5 state after the low level of res is sampled. sampling of res takes place at the fall of the system clock ( ). access to external address address bus cs 0 as rd (read access) hwr , lwr data bus i/o port res (write access) (write access) h'000000 high-impedance high-impedance high-impedance high high high internal reset signal t1 t2 t3 cs 7 to cs 1 figure d.1 reset during memory access (reset during t1 state)
appendix d pin states rev. 3.00 sep 27, 2006 page 866 of 872 rej09b0325-0300 reset in t2 state figure d.2 is a timing diagram for the case in which res goes low during the t2 state of an external memory access cycle. as soon as res goes low, all ports are initialized to the input state. as , rd , hwr , and lwr go high, and the data bus goes to the high-impedance state. the address bus is initialized to the low output level 0.5 state after the low level of res is sampled. the same timing applies when a reset occurs during a wait state (t w ). address bus cs 0 rd (read access) hwr , lw r data bus i/o port res as h'000000 high-impedance high-impedance high-impedance internal reset signal access to external address t1 t2 t3 (write access) (write access) cs 7 to cs 1 figure d.2 reset during memory access (reset during t2 state)
appendix d pin states rev. 3.00 sep 27, 2006 page 867 of 872 rej09b0325-0300 reset in t3 state figure d.3 is a timing diagram for the case in which res goes low during the t3 state of an external memory access cycle. as soon as res goes low, all ports are initialized to the input state. as , rd , hwr , and lwr go high, and the data bus goes to the high-impedance state. the address bus outputs are held during the t3 state.the same timing applies when a reset occurs in the t2 state of an access cycle to a two-state-access area. address bus cs 0 rd (read access) hwr , lwr data bus i/o port res as high-impedance high-impedance high-impedance internal reset signal access to external address t1 t2 t3 (write access) (write access) h'000000 cs 7 to cs 1 figure d.3 reset during memory access (reset during t3 state)
appendix e timing of transition to and recovery from hardware standby mode rev. 3.00 sep 27, 2006 page 868 of 872 rej09b0325-0300 appendix e timing of transition to and recovery from hardware standby mode timing of transition to hardware standby mode (1) to retain ram contents with the rame bit set to 1 in syscr, drive the res signal low 10 system clock cycles before the stby signal goes low, as shown below. res must remain low until stby goes low (minimum delay from stby low to res high: 0 ns). t 1 10t cyc t 0 ns 2 stby res (2) to retain ram contents with the rame bit cleared to 0 in syscr, or when ram contents do not need to be retained, res does not have to be driven low as in (1). timing of recovery from hardware standby mode drive the res signal low approximately 100 ns before stby goes high. stby res t 100 ns t osc
appendix f product code lineup rev. 3.00 sep 27, 2006 page 869 of 872 rej09b0325-0300 appendix f product code lineup table f.1 h8/3048 group product code lineup classification of products product type type of rom power supply specifications product code mark code package (package code) hd6433048bte 100-pin tqfp (tfp-100b) 5 v version hd6433048bf 100-pin qfp (fp-100b) hd6433048bvte 100-pin tqfp (tfp-100b) h8/3048b mask rom version 3 v version hd6433048bvf 100-pin qfp (fp-100b) hd64f3048bte 64f3048te 100-pin tqfp (tfp-100b) 5 v version hd64f3048bf 64f3048f 100-pin qfp (fp-100b) hd64f3048bvte 64f3048vte 100-pin tqfp (tfp-100b) h8/3048 f-one flash memory version (single power supply) 3 v version hd64f3048bvf 64f3048vf 100-pin qfp (fp-100b) hd64f3048tf hd64f3048tf 100-pin tqfp (tfp-100b) 5 v version hd64f3048f hd64f3048f 100-pin qfp (fp-100b) hd64f3048vtf hd64f3048vtf 100-pin tqfp (tfp-100b) h8/3048f flash memory version (dual power supply) 3 v version hd64f3048vf hd64f3048vf 100-pin qfp (fp-100b) hd6473048tf hd6473048tf 100-pin tqfp (tfp-100b) 5 v version hd6473048f hd6473048f 100-pin qfp (fp-100b) hd6473048vtf hd6473048vtf 100-pin tqfp (tfp-100b) h8/3048 ztat prom version 3 v version hd6473048vf hd6473048vf 100-pin qfp (fp-100b) hd6433048tf hd6433048( *** )tf 100-pin tqfp (tfp-100b) 5 v version hd6433048f hd6433048( *** )f 100-pin qfp (fp-100b) hd6433048vtf hd6433048( *** )vtf 100-pin tqfp (tfp-100b) h8/3048 mask rom version 3 v version hd6433048vf hd6433048( *** )vf 100-pin qfp (fp-100b) hd6433047tf hd6433047( *** )tf 100-pin tqfp (tfp-100b) 5 v version hd6433047f hd6433047( *** )f 100-pin qfp (fp-100b) hd6433047vtf hd6433047( *** )vtf 100-pin tqfp (tfp-100b) h8/3047 mask rom version 3 v version hd6433047vf hd6433047( *** )vf 100-pin qfp (fp-100b)
appendix f product code lineup rev. 3.00 sep 27, 2006 page 870 of 872 rej09b0325-0300 classification of products product type type of rom power supply specifications product code mark code package (package code) hd6433045tf hd6433045(***)tf 100-pin tqfp (tfp-100b) 5 v version hd6433045f hd6433045(***)f 100-pin qfp (fp-100b) hd6433045vtf hd6433045(***)vtf 100-pin tqfp (tfp-100b) h8/3045 mask rom version 3 v version hd6433045vf hd6433045(***)vf 100-pin qfp (fp-100b) hd6433044tf hd6433044(***)tf 100-pin tqfp (tfp-100b) 5 v version hd6433044f hd6433044(***)f 100-pin qfp (fp-100b) hd6433044vtf hd6433044(***)vtf 100-pin tqfp (tfp-100b) h8/3044 mask rom version 3 v version hd6433044vf hd6433044(***)vf 100-pin qfp (fp-100b) note: ( *** ) in mask rom versions is the rom code.
appendix g package dimensions rev. 3.00 sep 27, 2006 page 871 of 872 rej09b0325-0300 appendix g package dimensions the package dimension that is shown in the renesas semiconductor package data book has priority. note) 1. dimensions" * 1"and" * 2" do not include mold flash 2. dimension" * 3"does not include trim offset. * 1 * 2 * 3 p e d e d f 100 125 26 76 75 51 50 xm y z z d h e h b terminal cross section p 1 1 c b c b 2 1 1 detail f c a a l l a 1.0 1.0 0.08 0.10 0.5 8 0 0.25 0.12 0.15 0.20 0.00 0.27 0.22 0.17 0.22 0.17 0.12 3.05 16.3 16.0 15.7 l 1 z e z d y x c b 1 b p a h d a 2 e d a 1 c 1 e e l h e 0.7 0.5 0.3 max nom min dimension in millimeters symbol reference 14 2.70 16.3 16.0 15.7 1.0 14 p-qfp100-14x14-0.50 1.2g mass[typ.] fp-100b/fp-100bv prqp0100ka-a renesas code jeita package code previous code figure g.1 package dimensions (fp-100b)
appendix g package dimensions rev. 3.00 sep 27, 2006 page 872 of 872 rej09b0325-0300 note) 1. dimensions" * 1"and" * 2" do not include mold flash 2. dimension" * 3"does not include trim offset. 1.00 1.00 0.08 0.10 0.5 8 0 15.8 16.0 16.2 0.15 0.20 1.20 0.20 0.10 0.00 0.27 0.22 0.17 0.22 0.17 0.12 l 1 z e z d y x c b 1 b p a h d a 2 e d a 1 c 1 e e l h e 0.6 0.5 0.4 max nom min dimension in millimeters symbol reference 14 1.00 16.2 16.0 15.8 1.0 14 index mark * 1 * 2 * 3 p e d e d 100 1 f xm y 26 25 76 75 50 51 z z h e h d b 2 1 1 detail f c l a a a l terminal cross section p 1 1 b c b c p-tqfp100-14x14-0.50 0.5g mass[typ.] tfp-100b/tfp-100bv ptqp0100ka-a renesas code jeita package code previous code figure g.2 package dimensions (tfp-100b)
renesas 8-bit single-chip microcomputer hardware manual h8/3048b group publication date: 1st edition, august 2002 rev.3.00, september 27, 2006 published by: sales strategic planning div. renesas technology corp. edited by: customer support department global strategic communication div. renesas solutions corp. ?2006. renesas technology corp., all rights reserved. printed in japan.
sales strategic planning div. nippon bldg., 2-6-2, ohte-machi, chiyoda-ku, tokyo 100-0004, japan http://www.renesas.com refer to " http://www.renesas.com/en/network " for the latest and detailed information. renesas technology america, inc. 450 holger way, san jose, ca 95134-1368, u.s.a tel: <1> (408) 382-7500, fax: <1> (408) 382-7501 renesas technology europe limited dukes meadow, millboard road, bourne end, buckinghamshire, sl8 5fh, u.k. tel: <44> (1628) 585-100, fax: <44> (1628) 585-900 renesas technology (shanghai) co., ltd. unit 204, 205, aziacenter, no.1233 lujiazui ring rd, pudong district, shanghai, china 200120 tel: <86> (21) 5877-1818, fax: <86> (21) 6887-7898 renesas technology hong kong ltd. 7th floor, north tower, world finance centre, harbour city, 1 canton road, tsimshatsui, kowloon, hong kong tel: <852> 2265-6688, fax: <852> 2730-6071 renesas technology taiwan co., ltd. 10th floor, no.99, fushing north road, taipei, taiwan tel: <886> (2) 2715-2888, fax: <886> (2) 2713-2999 renesas technology singapore pte. ltd. 1 harbour front avenue, #06-10, keppel bay tower, singapore 098632 tel: <65> 6213-0200, fax: <65> 6278-8001 renesas technology korea co., ltd. kukje center bldg. 18th fl., 191, 2-ka, hangang-ro, yongsan-ku, seoul 140-702, korea tel: <82> (2) 796-3115, fax: <82> (2) 796-2145 renesas technology malaysia sdn. bhd unit 906, block b, menara amcorp, amcorp trade centre, no.18, jalan persiaran barat, 46050 petaling jaya, selangor darul ehsan, malaysia tel: <603> 7955-9390, fax: <603> 7955-9510 renesas sales offices colophon 6.0
h8/3048b group rej09b0325-0300 hardware manual 1753, shimonumabe, nakahara-ku, kawasaki-shi, kanagawa 211-8668 japan


▲Up To Search▲   

 
Price & Availability of HD64F3048F16

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X